Unity Move and Wait between Waypoints C# - Pease help!

Hello,
im currently programming a horror game and i try to make a script- but it failed.
I have a Horror clown 3d model, with have this script attached. Now i have 7 waypoints-
public Transform Waypoint1… and i want that if the game starts the clown move to waypoint 1-
but he should not walk- he should just appear there and wait at this waypoint for 10 seconds- than
he diasappear at waypoint 1 and appear at waypoint 2 wait there- and this continue until waypoint 7 is reached!

Im new in C# PLEASE HELP me :slight_smile:

Have a nice Day, regards

You may use coroutines. Try this code:

public Transform[] waypoints = new Transform[7];
private int curPosition = 0;

void Start()
{
    StartCoroutine("ClownMovement");
}

IEnumerator ClownMovement()
{
while(true) // Make an eternal loop in coroutine
{

transform.position = waypoints[curPosition].position;
curPosition ++;

if(curPosition >= waypoints.Length)
      yield break;

yield return new WaitForSeconds(10); // Wait for 10 seconds

}

}

THX IT WORKS :smiley: