unity on gameobject enabled code example
Example 1: unity c# set gameobject active
gameObject.SetActive(true)
Example 2: on GAMEOBJECT enable unity
void OnEnable()
{
Debug.Log("PrintOnEnable: script was enabled");
}
gameObject.SetActive(true)
void OnEnable()
{
Debug.Log("PrintOnEnable: script was enabled");
}