Answers for "doing void when gameobject setactive unity"

C#
10

setactive unity

gameObject.SetActive(true);
gameObject.SetActive(false);
Posted by: Guest on November-28-2019
1

doing void when gameobject setactive unity

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
    }
Posted by: Guest on December-19-2020

C# Answers by Framework

Browse Popular Code Answers by Language