Answers for "unity call a function every x seconds"

C#
5

unity call a function every x seconds

float x = seconds before the first invoke;
float y = seconds between every invoke;

InvokeRepeating("Function", x, y);
Posted by: Guest on July-25-2020
1

unity do task every x seconds

private float nextActionTime = 0.0f;
 public float period = 0.1f;
 
 void Update () {
     if (Time.time > nextActionTime ) {
        nextActionTime += period;
         // execute block of code here
     }
 }
Posted by: Guest on December-28-2020

Code answers related to "unity call a function every x seconds"

C# Answers by Framework

Browse Popular Code Answers by Language