- Home /
Question by
Shkarface-Noori · Sep 20, 2013 at 09:45 PM ·
eventufps
'EventType' does not contain definition for "MouseUp"
i just installed the UFPS AI Addon and i have this error:
CS0117: 'EventType'does not contain definition for "MouseUp" and it happens in a script called TargetMover.cs at line 23 as this is the code: using UnityEngine; using System.Collections;
public class TargetMover : MonoBehaviour {
/** Mask for the raycast placement */
public LayerMask mask;
public Transform target;
/** Determines if the target position should be updated every frame or only on double-click */
public bool onlyOnDoubleClick;
Camera cam;
public void Start () {
//Cache the Main Camera
cam = Camera.main;
}
public void OnGUI () {
if (onlyOnDoubleClick && cam != null && Event.current.type == EventType.MouseUp && Event.current.clickCount == 2) {
UpdateTargetPosition ();
}
}
// Update is called once per frame
void Update () {
if (!onlyOnDoubleClick && cam != null) {
UpdateTargetPosition ();
}
}
public void UpdateTargetPosition () {
//Fire a ray through the scene at the mouse position and place the target where it hits
RaycastHit hit;
if (Physics.Raycast (cam.ScreenPointToRay (Input.mousePosition), out hit, Mathf.Infinity, mask)) {
target.position = hit.point;
}
}
}
Comment
Was the supplied answer not useful to you? It it was please accept it, otherwise add your own answer on how you fixed this.
Best Answer
Answer by michael_house · Sep 20, 2013 at 11:05 PM
Since you've just installed another add-on this gives you a clue as to what might be happening. Ensure that the new add-on you installed does not also have an enum type EventType.
You can fully qualify the EventType you're trying to use with UnityEngine.EventType.MouseUp
so the compiler knows which one to use.
Your answer
![](https://koobas.hobune.stream/wayback/20220613114534im_/https://answers.unity.com/themes/thub/images/avi.jpg)