Created
December 20, 2018 07:29
-
-
Save hippocoder/4d48b2f33254ba8028225f80899d533d to your computer and use it in GitHub Desktop.
Draw the default inspector for your SettingsProvider to save time!
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
using UnityEditor; | |
static class GameSettingsProvider | |
{ | |
[SettingsProvider] | |
public static SettingsProvider CreateGameSettings() | |
{ | |
var provider = new SettingsProvider("Game/Settings", SettingsScope.Project) | |
{ | |
guiHandler = (searchContext) => | |
{ | |
Editor ed = Editor.CreateEditor(ScriptableObjectUtilities.GetOrCreate<GameSettings>(GameSettings.path)); | |
ed.OnInspectorGUI(); | |
}, | |
}; | |
return provider; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Normally you will want to supply the ScriptableObject yourself, but here is the GetOrCreate method for the curious: