実行順
- InitializeOnEnterPlayMode
- RuntimeInitializeLoadType.SubsystemRegistration
- RuntimeInitializeLoadType.AfterAssembliesLoaded
- RuntimeInitializeLoadType.BeforeSplashScreen
- RuntimeInitializeLoadType.BeforeSceneLoad
- RuntimeInitializeLoadType.AfterSceneLoad
検証環境
- Unity 2022.1.23f1
- macOS Monterey バージョン 12.5.1
- MacBook Pro 2021
検証用ソースコード
using UnityEngine;
internal static class Example
{
#if UNITY_EDITOR
[UnityEditor.InitializeOnEnterPlayMode]
private static void InitializeOnEnterPlayMode() => Debug.Log( "InitializeOnEnterPlayMode" );
#endif
[RuntimeInitializeOnLoadMethod( RuntimeInitializeLoadType.SubsystemRegistration )]
private static void SubsystemRegistration() => Debug.Log( "RuntimeInitializeLoadType.SubsystemRegistration" );
[RuntimeInitializeOnLoadMethod( RuntimeInitializeLoadType.AfterAssembliesLoaded )]
private static void AfterAssembliesLoaded() => Debug.Log( "RuntimeInitializeLoadType.AfterAssembliesLoaded" );
[RuntimeInitializeOnLoadMethod( RuntimeInitializeLoadType.BeforeSplashScreen )]
private static void BeforeSplashScreen() => Debug.Log( "RuntimeInitializeLoadType.BeforeSplashScreen" );
[RuntimeInitializeOnLoadMethod( RuntimeInitializeLoadType.BeforeSceneLoad )]
private static void BeforeSceneLoad() => Debug.Log( "RuntimeInitializeLoadType.BeforeSceneLoad" );
[RuntimeInitializeOnLoadMethod( RuntimeInitializeLoadType.AfterSceneLoad )]
private static void AfterSceneLoad() => Debug.Log( "RuntimeInitializeLoadType.AfterSceneLoad" );
}