Load script from scene that hasn't been loaded

Greetings, I’m fairly new to unity but so far I’ve been able to get by on google searches. Though I don’t seem to find a solution to this problem I’m having.

This is my situation :

I added a ‘Globals’ singleton script to the main menu scene (with DontDestroyOnLoad on its own instance) which holds, several values set through the inspector.

When I go through the main menu to other scenes I can access these values without any issue.

Now, I’d like to work on a different scene which needs these global values and I’d like to just press the play button in the unity editor to rapidly test my changes and not go through the main menu every time. But if I don’t go through the main menu, the Globals scipt doesn’t exist (and doesn’t get populated by the set inspector values).

Can I somehow get a script from an unloaded scene ? Or is there a different solution to my problem ? I could put the “Globals” script in every scene but that would kind of defeat the purpose and just create problems where I need to make sure that every “Globals” script is populated with exactly the same values across all my scenes manually.

Thanks in advance.

I’ve used two ways around this:

  • made my singleton check if it already exists and if it does, don’t overwrite it and manually delete the new object, then put it in each scene for testing.
  • put my singleton in a scene by itself, then used LoadLevelAdditive on that scene in the Awake() of a game object or the get of the static property which references the singleton.