So I’ve gone through all the other questions which were helpful, but I am still getting an error. Right now I am using javascript and I want to make it so when the player dies they return to the main menu or go to a death screen. This is the error:
Assets/scripts/player health.js(2,1): BCE0044: expecting EOF, found ‘import’.
And this is the script:
var health = 300;
import UnityEngine.SceneManagment;
function Update() {
}
function OnCollisionEnter(playerHit : Collision){
if (playerHit.gameObject.name == "zombie(Clone)"){
health -= 30;
}
if (playerHit.gameObject.name == "fireball(Clone)"){
health -= 15;
}
if (health <= 0)
{
SceneManager.LoadScene("MainMenu");
}
}
function OnGUI(){
GUI.Button(Rect(20,20,health,20), "");
}