I'm getting an error that I don't understand. The simplified version of my code:
using UnityEngine;
public class RunLater : MonoBehaviour
{
public static void Do()
{
Invoke("RunThisLater", 2.0f);
}
public void RunThisLater()
{
Debug.Log("This will run later");
}
}
One approach is to have the static parts of the class store a MonoBehaviour reference to itself. Like so:
You would now be able to call RunLater.Do() from anywhere in your code of other gameObjects. Good luck!