unity check if gameobject is active

Code Example - unity check if gameobject is active

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

check if gameobject is active

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

unity check gameobject active

                        
                                if (gameObject.activeInHierarchy)