Object OnMouseDown?

How do i place it on a empty object and use that to see what objects i clicked? without placing the script on every object i need it to check?

You could use a raycast from the camera instead, its far more efdicient than a csript on every gameovjext

Im kind of lost myself.

So lets say I make this

InputFactory.cs

Public class InputFactory : Monobehaviour, IPointerClickHandler

public void OnPointerClick(PointerEventData eventData)
{
Debug.Log("Clicked");
}

//Loads of other clicks handled

Now I want this one object to handle all clicks keyboard buttons and etc.

How do i get it to register clicks on an object in the screen, because the Debug.Log only works when i have the script attached to it.

This one only works on the object the script got attached to, because it’s sort of like an onMouseDownOverThisObject thingy, if you want to register clicking on any object without putting one of these codes on every single one, then use a raycast from the camera like this:

//if your camera is he main camera:
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
HitInfo hit;
if (Physics.Raycast(ray, out hit)) {
   now your clicked gameObject is hit.gameObject
}

or use an eventhandler

Okei so no point in looking further into that then! Thanks

I thought that the new unityevent system would be integrated in a manner that it allowed it to be more user friendly like that.

But I guess i have to make my own

OnLeftMouseDown()
{
if(Input.getMouseButtonDown(0)){

//Implement your code here

}
}

thanks for the help, really appreciate it gorbit99