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

Asked

Viewed 150 times

0

When I put this following script on unity and right after the association with a transparent form (without physics) and I click on play to test, gives an error saying that can not play (look at the print), can anyone help me? there’s something wrong with the script?

It’s written down here....
(sorry my inexperience I tried to be as detailed as possible!

inserir a descrição da imagem aqui

using UnityEngine;
using System.Collections;

public class Fall : MonoBehaviour {
    void OnTriggerEnter(Collider other) {
        Application.LoadLevel("level1"­);
    }
}

1 answer

5

You need to add to Scene level1 at Build Settings, so the game knows about it. When you call Loadlevel, Unity doesn’t know that the level1 file is a part of the game.

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

Go to File -> Build Settings: inserir a descrição da imagem aqui

Then drag your scene to the "Scenes In Build": inserir a descrição da imagem aqui

Browser other questions tagged

You are not signed in. Login or sign up in order to post.