- Home /
Can not get OnMouse Events working on custom GameObjects
Hi guys,
I know there has been a lot of questions about Unity's OnMouse events however I have not seen any answers that can help the problem I am receiving.
I have a very simple class, for test purposes, which just displays a debug on OnMouseEnter.
public class OnMouseEvents : MonoBehaviour
{
void OnMouseEnter ()
{
Debug.Log ("MouseEnter");
}
}
This class works as intended on one of Unity's primitives, for example the Sphere.
However when I attach this as a component on any other GameObject with the same collider I notice that the Debug does not get printed in the console.
I have made sure that the Camera and the GameObject are both on the same Layer, and that the GameObject with the component definitely has a collider.
Can someone please point out what I am doing wrong?
Thanks.
Your answer
Follow this Question
Related Questions
Sound won't PLAY!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1 Answer
[SOLVE] OnMouseEnter not working on UI elements 2 Answers
Make a "button" GameObject to grow and get smaller over x seconds, OnMouseEnter, C# 2 Answers
How to add OnMouseEnter to another object? 1 Answer
How do I get onmouseenter to trigger even if another collider is blocking th? 0 Answers