Answer the question
In order to leave comments, you need to log in
How to set a camera in a script from another script?
I tried to make a trigger that at the beginning of the animation of a certain object removes the player's movement script, and returns it at the end, but the movement script has a public camera and I tried to set it through the script, but I get an error
NullReferenceException: Object reference not set to an instance of an object>
public GameObject player;
public SC_FPSController sC_FPSController;
public Camera camera;
...
sC_FPSController.playerCamera = camera.GetComponent<Camera>();
player.AddComponent<SC_FPSController>();
...
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question