How to call a script from an object that is DontDestroyOnLoad


I am instantiating the Soomla plugin on my title screen, but I’d like to make a button in another scene call a function from the script that is on an object that only exists in the first scene initially, but it has a DontDestroyOnLoad command.

  1. GameObject exists in the first scene, but doesn’t get destroyed and thus is in every scene.
  2. I want a button to call a function from a script that is attached to this GameObject.

How do I call the function?

How about attaching the script on an empty object in the second scene, than calling it as you would in the first. :slight_smile:
In the long run I would definitely try something like a true singleton pattern. Loading...

You can use GameObject.Find<“objectname”>().getComponent()