Example #1
0
    /// <summary> Creates a new ScriptableObject asset, saves it that the given path if it exists, then returns the ScriptableObject. </summary>
    /// <typeparam name="T"> The type of ScriptableObject to be created. </typeparam>
    /// <param name="path"> The path of folder where the asset will be saved if it exists. </param>
    /// <returns> The new ScriptableObject that was created. </returns>
    public static T CreateAsset <T>(string path) where T : ScriptableObject
    {
        T asset = ScriptableObject.CreateInstance <T>(); // Creates the instance of the scriptable object.

        if (!AssetDatabase.IsValidFolder(path))          // Checks to make sure the path exists.
        {
            FolderUtility.CreateFolders(path);
        }

        SaveAssetInProjectFolders(asset, path); // Creates the asset in the project folders.

        return(asset);                          // Returns the scriptable object.
    }
 /// <summary> Generates required folder paths. </summary>
 public void GenerateFolders()
 {
     FolderUtility.CreateFolders(assetPathToControllerFolder);
     FolderUtility.CreateFolders(assetPathToConsolePrefabFolder);
     createAssets.SetEnabled(true);
 }