Noticias

¡RECUERDA QUE SI ERES UN NUEVO USUARIO, DEBES PRESENTARTE PARA PODER PUBLICAR MENSAJES! | TENEMOS CANAL OFICIAL DE TELEGRAM: t.me/unity3dspain

ayuda con condicion

Iniciado por deth, Mayo 26, 2016, 01:31:03 PM

Tema anterior - Siguiente tema
Hola amigos, necesito pasar a la segunda escena de mi juego cuando el score sea 5 pero no me funciona, aqui les dejo parte de mi codigo:
 

// JavaScript
var score = ;
public var SFX_Pickup_13 : AudioClip;
function OnTriggerEnter( other : Collider ) {
    Debug.Log("OnTriggerEnter() was called");
     if (other.tag == "moneda")
    {
        Debug.Log("Other object is a coin");
        score += 1;
        Debug.Log("Score is now " + score);
        audio.PlayOneShot(SFX_Pickup_13);
        Destroy(other.gameObject);          
     }
     
     if (score == 5)
     {
Application.LoadLevel (2);
     }
     }

 
PD: la segunda escena de mi juego se llama "2"
 
muchas gracias de antemano.

Entonces debes poner el 2 entre paréntesis.
 
PD: La clase Application es obsoleta, en su lugar se usa el SceneManager:
 
http://docs.unity3d.com/ScriptReference/SceneManagement.SceneManager.html

Etiquetas: