Last active
April 17, 2018 16:22
-
-
Save tsubaki/cbae9e188b51bc55824662a06217cea5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEngine.Experimental.LowLevel; | |
using UnityEngine.Experimental.PlayerLoop; | |
using System.Collections.Generic; | |
public class PreUpdateSystem | |
{ | |
[RuntimeInitializeOnLoadMethod()] | |
static void Init() | |
{ | |
var mySystem = new PlayerLoopSystem() | |
{ | |
type = typeof(MyLoopSystemUpdate), | |
updateDelegate = () => | |
{ | |
Debug.Log("DO IT!!!"); | |
} | |
}; | |
var playerLoop = PlayerLoop.GetDefaultPlayerLoop(); | |
var updateSystem = playerLoop.subSystemList[4]; // Update | |
var subSystem = new List<PlayerLoopSystem>(updateSystem.subSystemList); | |
subSystem.Insert(0, mySystem); | |
updateSystem.subSystemList = subSystem.ToArray(); | |
playerLoop.subSystemList[4] = updateSystem; | |
PlayerLoop.SetPlayerLoop(playerLoop); | |
} | |
public struct MyLoopSystemUpdate{ } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment