'How would i make a gameobject randomly choose from points and teleport to one of them?

i am making a FNAF fangame, and i want the "animatronic" to choose between points to move to and go to them on a timer(and keep doing it not just doing it once), how would i go about doing this?



Solution 1:[1]

Use a float as a time value, every Update add Time.deltaTime to it. When it gets greater than a set amount of seconds, set it to zero and call a method that places the animatronic.private

   float time=0;
   public float delay=10;

   public void Update()
   {
   time+=Time.deltaTime;
   if(time>=delay)
   {
   Place();
   }

   }

   private void Place()
   {
   //place the animatronic
   //choose the location wuth Random.Range(float,float)
   }

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 error13660