Hi I new coding in c# & I working on a script to enable / disable a Unity 5 gameobject clicking on another object for both actions, the first part runs ok, but in the second part to re-enable the object show me this error:
Assets/Script/Activar.cs(11,5): error CS1519: Unexpected symbol `else' in class, struct, or interface member declaration
this is the script:
using System.Collections;
using UnityEngine;
public class Activar : MonoBehaviour {
public GameObject modify;
void Update () {
if (Input.GetMouseButton (0))
modify.SetActive (false);
}
else {
modify.SetActive (true);
}
}
So what can I do to solve this? Thanks :)