Can scripts in the assets affect the game if their not in the scene?

I want my script that affects all the scenes but I don’t want to put it in every scene

This is an interesting question. The answer is yes, but perhaps not the in the sense you want. Let me explain.

Statics: static variables/functions/etc can be referenced without including them into the scene. This means if you have a bunch of scripts calling an algorithm, you could separate that into a static function and call that. (At least you used to be able to on functions. ) Variables are the easiest to incorporate, and they can be used to keep track of muti scene scoreboards or other tasks. A big benefit of statics is that you don’t need to get a reference to them in order to change/call them. This may save processing power (GameObject.Find) however, it may have drawbacks in other places (idk remember how efficient statics are anymore.)

Muti Scene Gameobjects: you can tell a game object to not delete itself unity docs. This means title music doesn’t stop when you enter the game, scripts continue to store their information, and basically what you would expect them to do.

Reading and Writing Files: Unity can create (public CustomScript test) arrays to store information and stuff that don’t teckencly exist the scene (man my spelling). You can also write to files, reference files, and a whole bunch of stuff. That would vary platform to platform (usually), but you can reference HTML documents, upload your own profile/character image, along with others.

However, the single biggest drawback with unity is that it can’t run a script without at least a single game object with that script attached. You can have scripts run Awake and Start, and generate your world, but they still need to be in the scene.

hope that helps!

Edit: As you have changed your description, here’s what you want to do. You will want to place a single game object in the first scene that you build. (most likely the menu) On this game object you will place your script.

public static ScriptName _Instance;
void Awake ()
  if(_Instance == null) {
    _Instance = this;
  } else {
} //rest of your code

If you don’t know what a singleton is basically it makes sure that there is only one instance of the script ever. This is important because if the scene where the original instance exists is gone back to, you don’t want two of the same scripts running. Using a static var to tell what the instance is, other scripts can reference it by using ScriptName._Instance. any public var/method/etc and that would be the normal reference.

Hello @TwitoGames !
Read this. Basically just add this to your code:

GameObject[] objs = GameObject.FindGameObjectsWithTag("yourTag");

if (objs.Length > 1)


Give the gameObject an unique tag in the inspector, make sure it is spelled correctly in the script, so you will avoid duplication issues. Hope it works.