Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: manage editor preset on loading #148

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions package/Editor/Settings/PluginSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ private void OnEnable()
{
GetVersionFromPackageJson();
LoadSettings();

}


Expand Down Expand Up @@ -164,7 +163,7 @@ private void DrawTileSettings()
/// <returns></returns>
private static Preset GetPreset(string _GUID)
{
if (_GUID != null)
if (_GUID != null && !string.IsNullOrEmpty(_GUID))
Morgan-6Freedom marked this conversation as resolved.
Show resolved Hide resolved
{
return AssetDatabase.LoadAssetAtPath<Preset>(AssetDatabase.GUIDToAssetPath(_GUID));
}
Expand Down Expand Up @@ -237,18 +236,33 @@ private void SaveSettings()
private void LoadSettings()
{
/// Register default values
if (!EditorPrefs.HasKey("scenario/texturePreset"))

if (!EditorPrefs.HasKey("scenario/texturePreset") /*&& string.IsNullOrEmpty(EditorPrefs.GetString("scenario/texturePreset"))*/)
{
EditorPrefs.SetString("scenario/texturePreset", "28269680c775243409a2d470907383f9"); //change this value in case the meta file change
}
else if(string.IsNullOrEmpty(EditorPrefs.GetString("scenario/texturePreset")))
{
EditorPrefs.SetString("scenario/texturePreset", "28269680c775243409a2d470907383f9"); //change this value in case the meta file change
}

if (!EditorPrefs.HasKey("scenario/spritePreset"))
{
EditorPrefs.SetString("scenario/spritePreset", "d87ceacdb68f56745951dadf104120b1"); //change this value in case the meta file change
}
else if (string.IsNullOrEmpty(EditorPrefs.GetString("scenario/spritePreset")))
{
EditorPrefs.SetString("scenario/spritePreset", "d87ceacdb68f56745951dadf104120b1"); //change this value in case the meta file change
}

if (!EditorPrefs.HasKey("scenario/tilePreset"))
{
EditorPrefs.SetString("scenario/tilePreset", "6d537ab5bf7649b44973f061c34b6151"); //change this value in case the meta file change
}
else if (string.IsNullOrEmpty(EditorPrefs.GetString("scenario/tilePreset")))
{
EditorPrefs.SetString("scenario/tilePreset", "6d537ab5bf7649b44973f061c34b6151"); //change this value in case the meta file change
}

//load values
apiKey = EditorPrefs.GetString("ApiKey");
Expand Down
Loading