예제 #1
0
        public void TrySaveWorldConfig(string worldName)
        {
            string parentFolder = "Assets/Config";

            string newFolder = "Resources";

            string extension = "asset";

            string assetPath = AssetHelper.GetAssetPath(parentFolder, newFolder, worldName, extension);

            if (AssetHelper.DoesAssetExist <WorldConfig>(assetPath))
            {
                if (!EditorUtility.DisplayDialog(
                        "Config file already exists!",
                        "Do you wish to overwrite world config with name: " + worldName + "?",
                        "Yep!",
                        "Shit no! Take me back!"))
                {
                    return;
                }
            }

            AssetHelper.TryCreateFolder(parentFolder, newFolder);

            CreateWorldConfig(assetPath);
        }
예제 #2
0
        public void TrySaveWorldPrefab(string worldName)
        {
            string parentFolder = "Assets/Prefabs";

            string newFolder = "Worlds";

            string extension = "prefab";

            string assetPath = AssetHelper.GetAssetPath(parentFolder, newFolder, worldName, extension);

            if (AssetHelper.DoesAssetExist <GameObject>(assetPath))
            {
                if (!EditorUtility.DisplayDialog(
                        "Prefab already exists!",
                        "Do you wish to overwrite prefab with name: " + worldName + "?",
                        "Yep!",
                        "Shit no! Take me back!"))
                {
                    return;
                }
            }

            AssetHelper.TryCreateFolder(parentFolder, newFolder);

            CreateWorldPrefab(assetPath);
        }