I am having serious problems with the Unity function "OnMouseUp" (also tried with OnMouseDown and others)
The problem I am getting is that the function is not reacting to clicks, but is not consistent on when it works and when it doesn't. Sometimes closing unity and open it back again made it work and sometimes it doesn't.
The code is fairly simple:
void OnMouseUp()
{
Debug.Log("Test");
}
This script is added to a gameObject with the following characteristics
Up to this point I would think that there is some problem on my end and that I am doing things wrong, but after a bit of testing I believe is more like a Unity Bug than me.
An example of this is that sometimes it would work and sometimes it wont (on the same coordinates in-game)
And another example is that if the gameObject prefab has the "Is triggered" selected when launching the game and right before clicking into the gameObject with the OnMouseUp script on it, I deselect it, It magically work. If then I change my prefab box "Is triggered" and launch the game with that, it won't work. In another hand, if I then select again the "Is triggered" while the game is running, it would work again.
My theory is that for some reason when changing the property "Is Triggered" while the game is running, somehow it refreshes it and allows the code to run.
I did some research online to see what I could be doing wrong, but couldn't find anything. If anybody knows what my problem is it would be highly appreciated, and if it's a bug, any other way to achieve the same results?