Skip to content
Snippets Groups Projects
Select Git revision
  • 88faad5b7f391d330bdc1a4809c40b6d4edf9020
  • master default
  • JS-based-scroll-rendering
  • Paul_Marius_Level
  • Paul_Marius_2
  • Paul_Marius
  • Andi_Mark
  • be-UnityWebView
  • gitignoreFrameitServer
  • ZimmerBSc
  • Bugfix_StageLoading
  • stages
  • MAZIFAU_Experimental
  • tsc/coneworld
  • tsc/fact-interaction
  • marcel
  • MaZiFAU_TopSort
  • mergeHelper
  • zwischenSpeichern
  • tempAndrToMaster
  • SebBranch
  • 3.0
  • v2.1
  • v2.0
  • v1.0
25 results

JSONManager.cs

Blame
  • GameObjectExtensions.cs 956 B
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    
    public static class GameObjectExtensions
    {
        public static void UpdateTagActive(this GameObject root, string tag, bool enable)
        {
            for (int i = 0; i < root.transform.childCount; i++)
            {
                GameObject child = root.transform.GetChild(i).gameObject;
                if (child.tag == tag)
                    child.SetActive(enable);
                else
                    UpdateTagActive(child, tag, enable);
            }
        }
    
        public static void DestroyAllChildren(this GameObject root)
        {
            for (int i = 0; i < root.transform.childCount; i++)
                GameObject.Destroy(root.transform.GetChild(i).gameObject);
        }
    
        public static GameObject GetNthChild(this GameObject root, List<int> pos)
        {
            GameObject ret = root;
            foreach (var i in pos)
                ret = ret.transform.GetChild(i).gameObject;
    
            return ret;
        }
    }