In the first place thanks, and i have to say im new into unity.
whenever i click on a block(from a board, like a board game) i want the player to move to that block, but it doesnt move.
here´s the method that should move the player(a.k.a chip)
public void Moving(float x, float z)
chip.transform.position = new Vector3( x, 0f, z);
Debug.Log(x + " " + z);
eventhough i click on a block and it shows in the console the right position, the player doesnt move.
one mmore thing, i dont know if its relevant but the player prefab has a “playerGraphic” sprite as child
First of all, welcome to Unity!
Your code seems to be correct. I think that’s why this question lasted so long without an answer to it. I’m not sure what is going wrong without seeing the rest of your program, the most I can do is provide general advice for tracking down the culprit. What is
chip? You should run the game in the editor, using the play button, and look at the actual values of the Transform component. Did they change? If not, can you verify that
chip is a reference to the Component or GameObject you think you’re affecting? Another scenario that happens to me sometimes: I change the position of something, and something else I coded and then forgot about changes it back. If this is so, you can write a debug statement in the
Update() event on the object you want to affect, and see what the position is each frame.
Good luck tracking it down!