Example #1
0
        /// <summary>
        /// Searches by tag for a GameObject and then through all its children to get provided script. If no GameObject is found it will create the provided _DefualtPrefab as a child of MANAGER.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="_TagOfHolder"></param>
        /// <param name="_DefaultPrefab"></param>
        /// <returns></returns>
        public static T CheckScriptAvailability <T>(string _TagOfHolder, GameObject _DefaultPrefab)
        {
            GameObject ScriptHolder = MANAGER.CheckGameObjectAvailability(_TagOfHolder, _DefaultPrefab);

            T Script = ScriptHolder.GetComponentInChildren <T>();

            return(Script);
        }
Example #2
0
        //this is the init on each game start
        //init manualy via inspector over buttons!
        void Awake()
        {
            if (GET == null)
            {
                DontDestroyOnLoad(this.gameObject);
                GET = this;
            }
            else if (GET != this)
            {
                Destroy(this.gameObject);
            }

            //if there are components missing add them to the dict!
            SetUp();

            //create them all and add into list also initializes them
            InitSinglitons();

            AWAKE_INIT_DONE = true;
        }
Example #3
0
 void OnEnable()
 {
     Target = (MANAGER)target;
 }