Hi guys, so I’m having some problem with making grids. First I’m making square with quads that have material with sprite shader and make that prefab. And then place them to make the grids.
But before I arrange them to make grids, I just placed two quads to test it. The problem is when I clicked at a quad, the other that I placed in was also clicked. In console i got 2 message from those objects at the same time.
I’m using raycast but I actually want to use this Unity - Scripting API: MonoBehaviour.OnMouseEnter() but it’s not working when I was tried it.
Thank you. Sorry for my bad english. I hope you guys can understand what i mean.
Using OnMouseEnter etc. requires that the objects have some kind of collider (2D/3D) and the script needs to be attached to the object you want to point at, i.e. on every single one.
How does your raycast approach look like?
I see that makes sense. I just realized that I attached that OnMouse… script not in the grid object.
So my raycast looks like detect all collider of all the grid object within the scene, but in console i got the message that i just pointed in one position in the world.
But nevermind, now I was able to use the OnMouse function. Thank you for the answer
Then there was probably something wrong in the script. Raycast’s are an important and valuable tool. In case you’re interested what’s wrong, just post it and people will have a look at itm only if you want though Anyways, I’m glad it works now.