Forum rules - please read before posting.

Issue by running cutscene by script after loading.

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

  • Solved!

    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.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.