ドキュメント

Unity Engine

Unity Engine

InitializeOnLoadMethodAttribute

Allow an editor class method to be initialized when Unity loads without action from the user.
読み終わるまでの所要時間 3 分最終更新 1ヶ月前

Definition

[AttributeUsage(AttributeTargets.Method)]public class InitializeOnLoadMethodAttribute : Attribute

Remarks

For new code, use OnCodeInitializingAttribute instead for better resource pre-allocation timing. For more information, refer to Code reload and the code lifecycle in the manual.

Examples

using UnityEngine;using UnityEditor;class MyClass{ [InitializeOnLoadMethod] static void OnProjectLoadedInEditor() { Debug.Log("Project loaded in Unity Editor"); }}

Inheritance

Inherited Members