Hi,
I need to run multiple cutscenes by their name on player collision. So I made a script attached on gameobjects.
OnTriggerEnter, I get the name of the object that has the same name as my cutscene.
Then I find the cutscene and use Interact();
For testing, I'm trying to run a cutscene named "Event1".
Line 12:
GameObject.Find("Event1").GetComponent<Cutscene>().Interact();
It's working fine multiple times, at each player collision, until I save.
After loading the scene with Pause menu, the cutscene won't run anymore and I have this console message at collision :
NullReferenceException: Object reference not set to an instance of an object
EventScript.OnTriggerEnter (UnityEngine.Collider other) (at Assets/_Scripts/EventScript.cs:12)
If someone can help me on this please.
Comments
I had checked "Reload even if scene is already open?" for some reasons on the OnLoad cutscene.
It seems that was the problem.
If it helps.