So my problem would be that I am making a 3D Shogi game and I am all new to unity, I just downloaded it 2 days ago, and I cannot find out how to make my pieces on the correct position on the board when I start with the play button. I already have a script which spawns 20 pieces what I need, but these are all under the board. I have to make them on the correct places, I would appreciate some help a lot.
I also attached the script on the second picture.
The quick and easy way to do it would be to spawn 1 piece in, move it so that it rests on top of the board, then read the Y value of its position in the inspector and set it explicitly as part of the MovePiece function.
p.transform.position.y = //put your calculated y value here
However hard coding these kind of offsets is bad practice and can only lead to headaches down the road. A “better” way may be to make an empty child object for the board and position it so that it rests on top of the board. Then you can get a reference to it and read its position at runtime, so that even if you move your board later the pieces will still spawn in the same spot
//When declaring class variables
//Drag your empty game object into this field in the inspector
public Transform referenceObject;
//Down in your actual code
p.transform.position.y = referenceObject.position.y;