unity check gameobject active

Code Example - unity check gameobject active

                
                        if (gameObject.activeInHierarchy)
                    
                
 

check if gameobject is active

                        
                                if (gameObject.activeSelf)
{
	// this happens when object is active
}
                            
                        
 

unity check if gameobject is active

                        
                                // To check if a GameObject is active:
gameObject.activeSelf;