ScriptReference/LowLevel.PlayerLoopSystem-updateDelegate #275
Replies: 1 comment
-
|
Comment by Unfortunately, this page doesn't have any example code but here's how to use updateDelegate to add your own code during a FixedUpdate: [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterSceneLoad)]
static void Init()
{
var playerLoop = UnityEngine.LowLevel.PlayerLoop.GetDefaultPlayerLoop();
for (int i = 0; i < playerLoop.subSystemList.Length; i++)
{
if (playerLoop.subSystemList[i].type == typeof(UnityEngine.PlayerLoop.FixedUpdate))
{
playerLoop.subSystemList[i].updateDelegate += MyFixedUpdate;
break;
}
}
UnityEngine.LowLevel.PlayerLoop.SetPlayerLoop(playerLoop);
Debug.Log("Game initialized");
}
static void MyFixedUpdate()
{
Debug.Log("Updating");
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
ScriptReference/LowLevel.PlayerLoopSystem-updateDelegate
https://docs.unity3d.com/ScriptReference/LowLevel.PlayerLoopSystem-updateDelegate.html
Beta Was this translation helpful? Give feedback.
All reactions