So, I created this Javascript script for if a camera detects this certain gameobject, it load the level ‘goodnight’.
#pragma strict
function Start () {
if (renderer.isVisible) {
Application.LoadLevel("goodnight");
}
}
function Update () {
if (renderer.isVisible) {
Application.LoadLevel("goodnight");
}
}
Now, it always keeps loading the level regardless, and cast and recieve shadows have been turned off and it still does not work. What should be changed in the code?