C# unexpected symbol error
im new to programming, this is my first code so i would really appreciate some help.
I have this script that keeps giving me two errors, i`ve checked on the internet and i couldn`t find a solution.
The script:
void Update() { if (Input.GetMouseButtonDown(0) && !UnityEngine.Eventsystem.Eventsystem.current.IsPointerOverGameObject()) }
The errors:
Assets/Scripts/World_interaction.cs(16,4): error CS1525: Unexpected symbol `}'
Assets/Scripts/World_interaction.cs(16,5): warning CS0642: Possible mistaken empty statement
Line 16 is the line with the end curly bracket.
Hello buddy,
You created the if statement but you are not doing anything inside of it, Error 2... Put a method inside of it or comment it putting // at the begining of the line.
Error 1 is because of the empty If statement
Answer by fiterpilot · Aug 15, 2017 at 12:14 AM
Hey, welcome to the scripting community :) For future reference, it really helps if you show the entire script and you use the code tag. The code tag aligns things a little better and allows for debugging to go a lot smoother. (Little 1's and 0's thing at the top of the text editor)
Appears you forgot the squiggly brackets at the end of your if statement. Here's what it should be:
void Update(){
if(Input.GetMouseButtonDown(0) && !UnityEngine.Eventsystem.Eventsystem.current.IsPointerOverGameObject()){
...
}
}
Your answer
Follow this Question
Related Questions
I have an error on a C# script @username 2 Answers
Nav Mesh Problem with SetDestination 1 Answer
Stuck with - Invalid Cast Exception 0 Answers