Hi, I created 5x5 grid of objects in unity c#. My questions is ,when I click on the object I want debug(print) that object position. Example " selected : 0,3".
I would do a raytrace from the camera, and get the coordinates of the object it from it’s transform.
You mean when ray hits the object ,i have to print objects x and y position??
Well I assumed you wanted the x, y, and z coordinates, but if you want the x and y of the object on-screen then you could just turn the 3d coordinates you got from the raytrace into the screen x and y with WorldtoScreenPoint (or a function similar to that, it’s on the scripting API so it should be easy to find)
thanks.
How to delete the object in a grid?
For Example I want to delete Grid[3,3] , How do i remove that object ?
Once you get the object from the raytrace, you should just be able to do Destroy(object) to delete it
How to i null that object grid position?If i delete the object in Grid[3,3] i have to null that position ,so can i do that??
Thanks