A Unity package that allows hooking pure C# classes to Unity's player loop
"com.alexandros.unity-player-loop-callbacks": "https://github.com/alexisstrat/unity-player-loop-callbacks.git?path=/Packages/com.alexandros.unity-player-loop-callbacks"PlayerLoopCallbacks.Instance.Update += ...
PlayerLoopCallbacks.Instance.FixedUpdate += ...
PlayerLoopCallbacks.Instance.LateUpdate += ...public class CSharpPlayerLoopSubscriber
{
public CSharpPlayerLoopSubscriber()
{
Subscribe();
}
private static void Subscribe()
{
PlayerLoopCallbacks.Instance.Update += OnUpdate;
PlayerLoopCallbacks.Instance.FixedUpdate += OnFixedUpdate;
PlayerLoopCallbacks.Instance.LateUpdate += OnLateUpdate;
}
private static void OnUpdate()
{
Debug.Log("Hello Update from C#!");
}
private static void OnLateUpdate()
{
Debug.Log("Hello LateUpdate from C#!");
}
private static void OnFixedUpdate()
{
Debug.Log("Hello FixedUpdate from C#!");
}
}