accesing objects variables

Hi everyone!

so far in my programming, I have been using the unity interface/debug to make objects acces other objects scripts.

for an example:

using UnityEngine;
using System.Collections;

public class shadow : MonoBehaviour {

public idea Idea;

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
	
	
	if(Idea.shadow1 == true)
	{
		
	transform.position = new Vector3(4,7,0);	
		
	}
	

}

}

setting a variable for idea-script, then I’ve set the object it’s linked to in the Unity object inspector.

but now I’ve come to a problem. The object that holds the variables has “DontDestroyOnLoad” to exist in even when I change scene. but if the variables will be reset if I put this object in every scene I need to refer the code.

is there another way to acces the variables?

Sup dawg, heard you needed to Find stuff.

http://unity3d.com/support/documentation/ScriptReference/GameObject.Find.html

Shouldn’t be a long read, but the long and short is the Find method will search through the current scene and look for the an GameObject by the given name.

So all you need to do know is when your scene changes, have like a manager or spark or initialization script in the scene that will search for the the Don’tDestroyOnLoad script, and have the initialization script tell the don’t destroy script that the scene has change and it should go about Finding all the GameObjects it’ll need to function in this scene.