📜  当gameobject setactive unity时做void - C#代码示例

📅  最后修改于: 2022-03-11 14:48:54.401000             🧑  作者: Mango

代码示例2
void OnEnable() //This void works only when the script is enabled, but when the GameObject enables, the script does to so you can use for gameObject activating
    {
        Debug.Log("PrintOnEnable: script was enabled"); //Your code here
    }

void OnDisable() //Same for the Disable function
    {
        Debug.Log("PrintOnDisable: script was disabled"); //Your code here
    }