- Home /
Problem has been fixed
Parsing error in script
I was hoping someone could help me with this script. Everything works fine with the script in the "void OnTriggerEnter" so just ignore that but the "void Update" is the problem. It says that there is a parsing error and that it does not expect the "}". But it should right, because that is the end of the update function? I am learning C# so please if it is something stupid (which it probably is) just note that I am learning. Thanks for the help in advance!
using UnityEngine; using System.Collections; using UnityEngine.SceneManagement;
public class Player : MonoBehaviour {
[SerializeField]
private Stat health;
// Use this for initialization
private void Awake()
{
health.Initialize();
}
// Update is called once per frame
void Update ()
{
if (health == 0)
SceneManager.LoadScene ("02")
}
void OnTriggerEnter2D(Collider2D other)
{
health.CurrentVal -= 10;
}
}
Answer by gjf · Apr 09, 2016 at 05:16 PM
you're missing a semicolon on line 13:
SceneManager.LoadScene ("02")
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Parsing Error, code in android for a button 2 Answers
UNITY_MVP_MATRIX error when downloading A* Pathfinding 1 Answer