I’m trying to make a toggle script but I get this error “Only assignment, call, increment, decrement, and new object expressions can be used as a statement” can u help me, this is my script\
- using UnityEngine;
- using System.Collections;
- public class Steel_Sight : MonoBehaviour {
- private bool sight;
- public Transform SteelSightPoint;
- public Transform GunPoint;
- void Update ()
- {
- if (Input.GetKeyUp (KeyCode.Mouse1) && sight == false) {
- this.transform.position = SteelSightPoint.transform.position;
- sight == true;
- }
- if (Input.GetKeyDown (KeyCode.Mouse1) && sight == true) {
- this.transform.position = GunPoint.transform.position;
- sight == false;
-
}
-
}
- }