Hello. I currently have the following code:
public class References : MonoBehaviour {
public GameObject scriptContainerRef;
static public GameObject scriptContainer;
public GameObject backgroundRef;
static public GameObject background;
public GameObject wallRef;
static public GameObject wall;
void Start () {
scriptContainer = scriptContainerRef;
wall = wallRef;
background = backgroundRef;
}
}
along with:
What it does is having scriptContainerRef, backgroundRef and wallRef point to a prefabs. then it make the 3 static variables point to these prefabs aswell, since static variables will not show up on the inspector thingy (image). From there scripts that aren’t created by the time i start the game, can create prefabs by refering to them as References.wall etc.
Now, I’m going to add a lot of diffrent objects, and this way is pretty clumsy if you ask me. Is there a simpler way?
It would have been so much easier if static variables would be visible in the inspector list thingy (image), but ofcourse that would create problems when 2 objects with that same script point to 2 diffrent places…
Thanks in advance