私のスクリプトはキャラクターコントローラーに接続されています。
そして、私は宣言しました、
public Camera camera;
クラスで。私が与えた更新機能では、
if(Input.GetMouseButtonDown(0)){
Ray ray = camera.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast (ray, out hit3, 400.0F)){
print(hit3.collider.gameObject.name);
}
}
しかし、私はエラーが発生しています
"UnassignedReferenceException:
The variable camera of 'characterScript' has not been assigned.
You probably need to assign the camera variable of the
characterScript script in the inspector."
良い解決策を教えてください。
前もって感謝します。