Skip to content

Instantly share code, notes, and snippets.

@MiketoString
Created April 20, 2016 18:26
Show Gist options
  • Save MiketoString/7c3ac553c7a8122098f9c636b9e4a5a9 to your computer and use it in GitHub Desktop.
Save MiketoString/7c3ac553c7a8122098f9c636b9e4a5a9 to your computer and use it in GitHub Desktop.
using UnityEngine;
using System.Collections;
[ExecuteInEditMode]
public class UnityUICounts : MonoBehaviour {
public int TotalRectTransforms = 0;
public int ImageObjectCount = 0;
public int TextObjectCount = 0;
public int ButtonObjectCount = 0;
#if UNITY_EDITOR
void Update () {
ImageObjectCount = GetComponentsInChildren<UnityEngine.UI.Image>( true ).Length;
TextObjectCount = GetComponentsInChildren<UnityEngine.UI.Text>( true ).Length;
ButtonObjectCount = GetComponentsInChildren<UnityEngine.UI.Button>( true ).Length;
TotalRectTransforms = GetComponentsInChildren<RectTransform>( true ).Length;
}
#endif
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment