LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

This version of Unity is unsupported.

InitializeOnLoadMethodAttribute

class in UnityEditor

Description

Allow an editor class method to be initialized when Unity loads without action from the user.

using UnityEngine;
using UnityEditor;

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