What are the parameters for OnMouseOver and how can I use them?
I am trying to get a gameObject (A plank from the free 2d graphics package) to self-delete. OnMouseOver () is not working for me, as I always get this message while hovering over the area I want it to detect: Failed to call function OnMouseOver of class Destroy Calling function OnMouseOver with no parameters but the function requires 1. UnityEngine.SendMouseEvents:DoSendMouseEvents(Int32)
My code is:
#pragma strict
function OnMouseOver(Collider2D)
{
Debug.Log("This part worked- it can sense you hovering!");
if(Input.GetMouseButton(0))
Destroy (gameObject);}
I know I am probably missing something really obvious here, thank you for your help! There are no colliders in front of the one I want. I don't want work-arounds unless they are simple because this is my first project and I am a beginner. Thanks!
Your answer
Follow this Question
Related Questions
poblem with OnMouseEnter handle 0 Answers
Health variable not changing 1 Answer
2D prefabs(Enemy) overlap issue 0 Answers