Hi, I have a Generator class that create an array of game object instances and I have a Player class where I have to access that array.
How could I get the Generator instance from the Player class to get the array?
Thanks
Hi, I have a Generator class that create an array of game object instances and I have a Player class where I have to access that array.
How could I get the Generator instance from the Player class to get the array?
Thanks
in the Player script:
var generator : Generator;
function Start() {
generator = FindObjectOfType(Generator) as Generator;
}
// then we can use any public variable from generator script
function Update() {
if(generator.somethingThatShouldBeTrue == true) DoSomething();
}
Thanks Jlu! That was helpful!