Version: 2019.3

InitializeOnLoadAttribute

class in UnityEditor

マニュアルに切り替える

説明

Allows you to initialize an Editor class when Unity loads, and when your scripts are recompiled.

Static constructors with this attribute are called when scripts in the project are recompiled (also known as a Domain Reload). This happens when Unity first loads your project, but also when Unity detects modifications to scripts (depending on your Auto Refresh preferences), and when you enter Play Mode (depending on your Play Mode configuration).

See Also: running editor code on launch.