using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

[ExecuteInEditMode]
public class HideChildGameObjects : MonoBehaviour {

	[HideInInspector]
	public bool hidden = true;

	void Start () {
		hidden = true;
		HideYoKids ();
	}

	void OnValidate () {
		hidden = true;
		HideYoKids ();
	}

	void HideYoKids () {
		if (hidden && SceneManager.GetActiveScene().name != "Launcher" && SceneManager.GetActiveScene().name != "GameIsland" && SceneManager.GetActiveScene().name != "Esports Launcher")
			for (int i = 0; i < transform.childCount; i++)
				transform.GetChild(i).hideFlags = HideFlags.HideInHierarchy;
		else
			for (int i = 0; i < transform.childCount; i++)
				transform.GetChild(i).hideFlags = HideFlags.None;
	}
}
