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
Debugin 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.
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.
– dstearsHi 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.
– IsabelWu314