Pointer completely not detected

I am working on inventory system for my 2D game. It worked smoothly until suddenly my pointer stopped being detected.

The several methods that depends on event trigger: OnPointerClick, OnPointerExit, OnPointerDown, OnPointerExit - all stop working.

  • I wrote Debug in the attached script method and they were all not triggered.

  • Then I tried to create new gameobjects under other gameobject parents but they still not working.

  • I also create button component to make sure the problem is not limited to event trigger - and it also did not work.

There I drew a conclusion that the game panel in Unity is not detecting my pointer.

What could be wrong then and how could I solve it?

Is it possible that you added a new gameObject on top of the existing ones (like a Canvas) which is intercepting all of the clicks so your other objects no longer see them? You could try temporarily disabling other objects in the scene that are not related to the inventory to check.

Hi dstears, I disabled all the items besides the inventory item (that i need to click on), it's parents, and the main camera. But it is still not working. I add another gameobject directedly under the sample scene, and made its layer number the largest, add event trigger to it, and give onclick event CheckPointerClicked(){debug.Log("pointer clicked");}, and still nothing happened.

1 Answer

1

The question is solved. I accidentally delete the event system without knowing its importance. Also the graphic raycaster component was deleted from the ui button, which I did not notice when it happened (probably they were automatically deleted when I delete the event system?). Anyways, after adding them, the ui buttons return back to normal — a mistake caused by not familiar with the basic values of event system, learned a lot from this bug.