Unity_Utils/Extensions/GameObjectExtensions.cs
2021-07-31 22:24:34 -04:00

19 lines
437 B
C#

using UnityEngine;
public static class GameObjectExtensions
{
public static int GetNumberOfComponents(this GameObject gameObject)
{
return gameObject.GetComponentsInChildren<Component>().Length - 1;
}
public static void Show(this GameObject gameObject)
{
gameObject.SetActive(true);
}
public static void Hide(this GameObject gameObject)
{
gameObject.SetActive(false);
}
}