error here in my script to make the character give respawn (load.level)

0

When I put this script in unity and soon after I associate it with a transparent form (without physics) and click on play to test, it gives an error saying that it can not play (look at print), someone can help me? Is something wrong with the script?

It's written down here ....
(sorry for my inexperience I tried to be as thorough as possible!

usingUnityEngine;usingSystem.Collections;publicclassFall:MonoBehaviour{voidOnTriggerEnter(Colliderother){Application.LoadLevel("level1"­);
    }
}
    
asked by anonymous 12.10.2015 / 22:57

1 answer

5

You need to add scene level1 in Build Settings, so the game knows about it. When you call LoadLevel, Unity does not know that the level1 file is a scene part of the game.

"But the scene is in the game folder". Yes, but just because it is there does not necessarily mean that it will be included in the build.

Go to File - > Build Settings:

Andthendragyourscenetothe"Scenes In Build" section:

    
13.10.2015 / 00:26