Beispiel #1
0
        public static GameObject CreateUIFromPrefab(UIPoolSystem poolSystem, int prefabID, string prefabPath, Transform parent)
        {
            // Instantiate
            var prefab = poolSystem.Get(prefabID);

            if (prefab == null)
            {
                prefab = Resources.Load <GameObject>(prefabPath);
                poolSystem.Push(prefabID, prefab);
            }
            var ui = GameObject.Instantiate(prefab, parent);

            return(ui);
        }
Beispiel #2
0
        public UIPopupSystem()
        {
            popCp           = new UIPopupComponent();
            poolSystem      = new UIPoolSystem();
            popuiShowSystem = new ShowPopSystem();

#if UNITY_EDITOR
            string folderName = Application.dataPath + "/Resources/" + popCp.POP_PATH.Substring(0, popCp.POP_PATH.Length - 1);
            if (Directory.Exists(folderName) == false)
            {
                Directory.CreateDirectory(folderName);
                AssetDatabase.Refresh();
            }
#endif
        }