I’ve set up a 2d array of gameobjects[x,y]
The player selects one of these objects in the game world eg. raycast/mouseclick
How do I know which x,y position in the array the selected object is?
I need to know as I have a second array I want to cross-reference.
please halp! 
Unfortunately there’s no built-in method for 2D arrays like IndexOf.
What you can do is basically 2 things:
- Which I personally favorite, is to store on each game object it’s position in the array as you instantiate it.
- Which is less favorable, is to iterate over the array until you find the object the player has clicked like so.