Question by
xd_m687 · Apr 06 at 05:43 AM ·
coordinates
gameobject.transform.position not working correctly,
hey guys, I try to move the player back to the center of the map after each round of combat,but it didn't work ,here's the code:
if (!GameObject.FindGameObjectWithTag("Player"))
Instantiate(player, new Vector3(-mapSize.x / 2 + 0.5f + mapCenter.x, 0.5f, -mapSize.y / 2 + 0.5f + mapCenter.y), Quaternion.identity);
else
{
Debug.Log("111");
//player.SetActive(false);
player.transform.position= new Vector3(-mapSize.x / 2 + 0.5f + mapCenter.x, 0.5f, -mapSize.y / 2 + 0.5f + mapCenter.y);
//player.SetActive(true);
}
It is so weird! I already try setActive(false) but no available, hope anyone can help.
Comment
gameObject transform position can not work incorrectly, give extra details