Hi Guys ! II have a question, I have 5 enemys in 5 different position, during the match they move around the level, there is a way to reset their position like the start position ? The start position there is not 0,0,0…
Thank you guys
Hi Guys ! II have a question, I have 5 enemys in 5 different position, during the match they move around the level, there is a way to reset their position like the start position ? The start position there is not 0,0,0…
Thank you guys
When you instantiate the 5 enemies at the 5 different positions store their Vector3 transform.position to an array then on the reset button set the transform.position to the stored list of Vector3’s probably want to store their transform.rotation as a Quaternion also.
Well yeah, that would be easy.
public class MyEnemyClass : MonoBehaviour
{
private Vector3 originalPosition;
void Awake()
{
StorePosition();
}
public void StorePosition()
{
originalPosition = transform.position;
}
public void ResetPosition()
{
transform.position = originalPosition;
}
}