Hi,
In my main scene there are 36 lanterns, which can be set to inactive whilst playing the game. (though some will remain active once the game has ended, depending on which colliders are hit)
When the title scene loads there are 36 corresponding lights.
On loading the title scene, I want only the lights to be set to active which correspond to the lanterns in the main scene which were still set to active when the game ended.
The lights which correspond to the lanterns which were set to inactive whilst playing the game in the main scene, I want to be set to inactive for 5 seconds, and then to also be set to active.
(so after 5 seconds - all 36 lights in the title scene are active again)
I attached a dontdestroyonload script in the main scene, but I’m struggling to get my script working in the title scene.
Any ideas on what I’m doing wrong?
Title scene script:
var light1 : GameObject;
function Start () {
if(GameObject.Find("LanternA3A4").activeInHierarchy == true) {
light1.active = true;
}
if(GameObject.Find("LanternA3A4").activeInHierarchy == false) {
light1.active = false;
yield WaitForSeconds (4);
light1.active = true;
yield WaitForSeconds (1);
Destroy (GameObject.Find("LanternA3A4"));
}
}
Main scene script:
var lantern1 : GameObject;
function Update() {
DontDestroyOnLoad(lantern1);
}
(I’ve just shown the script for 1 light, rather than all 36, so it’s not too long to see here)
Best, Laurien