loadType | 确定是在场景加载之前还是之后 调用这些方法。 |
创建加载场景时使用的运行时类。
// Demonstration of RuntimeInitializeOnLoadMethod and the argument it can take. using UnityEngine;
class MyClass { [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] static void OnBeforeSceneLoadRuntimeMethod() { Debug.Log("Before first Scene loaded"); }
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterSceneLoad)] static void OnAfterSceneLoadRuntimeMethod() { Debug.Log("After first Scene loaded"); }
[RuntimeInitializeOnLoadMethod] static void OnRuntimeMethodLoad() { Debug.Log("RuntimeMethodLoad: After first Scene loaded"); } }