OnMouseUp(OtherObject)

Can I use the on MouseUp function to look for other objects being clicked aside from the current object.

I tried

 function OnMouseUp(OtherObject)
{
DoStuff();
}

…but that doesnt seem to work. Basically I dont want all my ‘other’ objects to have to have a script attached with some OnMouseUp() function.

Any ideas?[/code]

What you will probably want to do is a raycast on MouseUp to get other objects below the mouse

function OnMouseUp()
{
  var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
  
  var hit : RaycastHit;
  if (Physics.Raycast (ray, hit, 100)) 
  {
    Debug.Log (hit.collider.gameObject.name);
  }
}

You will have to make sure that all of the objects you want to be able to mouse up over have colliders or the raycast won’t work.

That won’t work, but if you do raycasting by using Input.GetMouseButtonUp in Update or whatever, that will. The function OnMouseUp is only for the object that the function is on.

–Eric

Oh yeah sorry about that, I am used to wrapping all input to a single manager class (which would call MouseUp from Input.GetMouseButtonUp()) and confused the two.