I’m trying to set up a grid that would be represented like a 3d chess board. Where you would be able to click a piece and select a place to move it too. I’ve searched around and haven’t been able to find anything to reference off of in order to start building my game. If anyone could help it would be greatly helpful.
Making the grid, Instantiate in the docs has an example of that. For movement, OnMouseOver/Out can be used to highlight/unhighlight the piece or square you are over (either change the texture or the material color.) OnMouseUpAsButton can check for a selection.
The script for each grid square (along with OnMouseOver and clicked) would have global vars for the x,y,z grid space, which could be used to check for legal moves. You’d fill those in as you spawn them.
Use a global “state” var something like: Tranform m1; // piece to move. null=they are still picking a peice to move, anything else means we are waiting for them to click on a square to try to move to.
Or, you could just use screen mousePointer raycasts to check what you are on, and Input.GetMouseButtonDown (instead of given eachsquare OnMouseOver.) I’d still give them all a script with just their position, and maybe the piece on them.
All the pieces are floating around here as answers, somewhere, once you break it down.