When attaching a static game object or singleton script to a game object in a current scene, how can I keep the static object attached to the original game object without it being removed after switching scenes?

My apologies for the long question:

I’m creating an RPG and have designed it so my that my various game menu panels display on separately loaded game scenes.

Each panel in a new scene has an independent EventSystem with a “First Selected” spot designated to a particular button on the panel.

For the game objects that do not contain static variables, there is no problem.

However, I have another EventSystem on a panel that has static button attached, The first time I access that panel, the button is rightfully assigned, however, after the next attempt (and all others after that) the static button is removed and is then “Missing”.

I’ve seen this problem other times when I’ve tried to attach static objects to non-static game objects in a scene.

Could someone inform me as to why this happens and provide me with some advice as to how to fix this predicament?

Thank you!

Hello! Try this:

DontDestroyOnLoad(gameObject) ;