-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor Settings to be ScriptableObjects.
- Loading branch information
Showing
10 changed files
with
223 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using UnityEngine; | ||
using UnityEditor; | ||
using System.IO; | ||
|
||
namespace UnityBuild | ||
{ | ||
|
||
public class BaseSettings : ScriptableObject | ||
{ | ||
protected const string SettingsPath = "Assets/Editor Default Resources/UnityBuildSettings/"; | ||
|
||
protected static T CreateAsset<T>(string assetName) where T : BaseSettings | ||
{ | ||
T instance = EditorGUIUtility.Load("UnityBuildSettings/" + assetName + ".asset") as T; | ||
if (instance == null) | ||
{ | ||
Debug.Log("UnityBuild: Creating settings file - " + SettingsPath + assetName + ".asset"); | ||
instance = CreateInstance<T>(); | ||
instance.name = assetName; | ||
|
||
if (!Directory.Exists("Assets/Editor Default Resources")) | ||
AssetDatabase.CreateFolder("Assets", "Editor Default Resources"); | ||
|
||
if (!Directory.Exists("Assets/Editor Default Resources/UnityBuildSettings")) | ||
AssetDatabase.CreateFolder("Assets/Editor Default Resources", "UnityBuildSettings"); | ||
|
||
AssetDatabase.CreateAsset(instance, SettingsPath + assetName + ".asset"); | ||
} | ||
|
||
return instance; | ||
} | ||
} | ||
|
||
} |
4 changes: 2 additions & 2 deletions
4
...d/Settings/BuildSettingsGenerator.cs.meta → Editor/Build/Settings/BaseSettings.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.