Hi guys! I wrote script which shoul take me back to menu after player jumps on special floor. I wrote such script and the debugger is saying that the code is okay, but it doesn’t work.
using UnityEngine;
using System.Collections;
public class EndGame : MonoBehaviour {
public string levelToLoad;
void OnTriggerEnter (Collision col){
if(col.gameObject.name == "KoniecGry"){
Application.LoadLevel (levelToLoad);
}
}
}
I tried everything. Main Camera is a rigidbody and has this script attached. The special floor called KoniecGry also has this script, but doesn’t has the rigidbody component. I don’t know where is the mistake