onMouseOver Not working properly
Hi everyone, I have looked through many threads in reference to onMouseOver not working properly but none of the solutions have worked properly for me. My script is on an empty object with a 2D polygon collider attached. Here is my script:
public class MouseDeadzone : MonoBehaviour {
public bool isTriggered;
// Use this for initialization
void Start () {
isTriggered = false;
Physics.queriesHitTriggers = true;
}
void update(){
Debug.Log (isTriggered);
}
void onMouseOver(){
isTriggered = true;
}
void onMouseExit(){
isTriggered = false;
}
}
The debug shows isTriggered as false even when the mouse is within the collider's zone. I should mention that I am working in 2D and my collider object is the child of a moving and rotating object with a rigidbody and physics. I would rather get this to work than create a raycast, so if anyone has a solution to this it would be greatly appreciated.
Your answer
Follow this Question
Related Questions
Collider problems? 2 Answers
im trying to show ui when looking at object from 2 units away 0 Answers
Trigger Collinder doesnt work with Input.GetKey 1 Answer
can you access multiple colliders on the same gameObject? 1 Answer
OnMouseOver with Polygon Collider2D not working for Gameobjects with Y >= 0 0 Answers