void InstantiateBar(int num)
        {
            if (num < 0 || num >= progressBarPrefabs.Length)
            {
                return;
            }

            currentPrefab = num;

            if (bar != null)
            {
                Destroy(bar.gameObject);
            }

#if UNITY_5_2 || UNITY_5_3 || UNITY_5_4_OR_NEWER
            bar = Instantiate <ProgressBarPro>(progressBarPrefabs[num], prefabParent);
#else
            bar = Instantiate(progressBarPrefabs[num]) as ProgressBarPro;
            bar.transform.SetParent(prefabParent);
#endif
            bar.gameObject.SetActive(false);
            bar.transform.localScale = Vector3.one;
            bar.SetValue(currentValue);
            bar.gameObject.SetActive(true);

            prefabName.text = progressBarPrefabs[currentPrefab].gameObject.name;

            Invoke("EnableBar", 0.01f);
        }
Esempio n. 2
0
        void TriggerDetection(ProgressBarPro progressBarPro)
        {
            if (progressBarPro == null)
            {
                return;
            }

            Undo.RecordObject(progressBarPro, "Detected View Components in Children");
            progressBarPro.DetectViewObjects();
            EditorUtility.SetDirty(progressBarPro);
        }