Skip to content

Commit

Permalink
Hotfix/fix core settings (#123)
Browse files Browse the repository at this point in the history
### Fixed
- issue where order of operations caused scriptable object creation errors
  • Loading branch information
HarrisonHough authored Sep 11, 2023
1 parent 75623c9 commit 13b8af4
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 19 deletions.
4 changes: 1 addition & 3 deletions .github/latest.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@
## Changelog

### Fixed
- an issue with module installer causing errors when importing on some Windows machines by @rYuuk in [#117](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/117)


- an issue causing settings to be recreated when not needed @harrisonhough in [#123](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/123)
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [3.2.3] - 2023.09.11
### Fixed
- an issue causing settings to be recreated when not needed @harrisonhough in [#123](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/123)

## [3.2.2] - 2023.09.07

### Fixed
Expand Down
5 changes: 1 addition & 4 deletions Editor/BuildPostProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ public static class BuildPostProcessor
public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject)
{
// create asset if it has been deleted
if (CoreSettingsHandler.CoreSettings == null)
{
CoreSettingsHandler.CreateCoreSettings();
}
CoreSettingsHandler.EnsureSettingsExist();
AppData appData = ApplicationData.GetData();
AnalyticsEditorLogger.EventLogger.LogBuildApplication(appData.BuildTarget, PlayerSettings.productName, !Debug.isDebugBuild);
}
Expand Down
2 changes: 1 addition & 1 deletion Editor/Module Management/ModuleInstaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ static ModuleInstaller()

private static void DelayCreateCoreSettings()
{
CoreSettingsHandler.CreateCoreSettings();
EditorApplication.delayCall -= DelayCreateCoreSettings;
CoreSettingsHandler.EnsureSettingsExist();
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ After the process is complete you project will have imported these packages:
}
],
"dependencies": {
"com.readyplayerme.core": "3.2.2"
"com.readyplayerme.core": "3.2.3"
}
}
```
Expand Down
23 changes: 15 additions & 8 deletions Runtime/CoreSettingsHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,14 @@ public static CoreSettings CoreSettings
{
get
{
if (coreSettings != null) return coreSettings;
coreSettings = Resources.Load<CoreSettings>(RESOURCE_PATH);
#if UNITY_EDITOR
if (coreSettings == null)
{
coreSettings = Resources.Load<CoreSettings>(RESOURCE_PATH);
#if UNITY_EDITOR
if (coreSettings == null)
{
coreSettings = CreateCoreSettings();
}
#endif
coreSettings = CreateSettings();
}
#endif
return coreSettings;
}
}
Expand All @@ -49,7 +47,16 @@ public static void Save()
AssetDatabase.SaveAssets();
}

public static CoreSettings CreateCoreSettings()
public static void EnsureSettingsExist()
{
coreSettings = Resources.Load<CoreSettings>(RESOURCE_PATH);
if (coreSettings == null)
{
coreSettings = CreateSettings();
}
}

private static CoreSettings CreateSettings()
{
DirectoryUtility.ValidateDirectory($"{Application.dataPath}/{SETTINGS_SAVE_FOLDER}");
var newSettings = ScriptableObject.CreateInstance<CoreSettings>();
Expand Down
2 changes: 1 addition & 1 deletion Runtime/Data/ApplicationData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace ReadyPlayerMe.Core
{
public static class ApplicationData
{
private const string SDK_VERSION = "v3.2.2";
private const string SDK_VERSION = "v3.2.3";
private const string TAG = "ApplicationData";
private const string DEFAULT_RENDER_PIPELINE = "Built-In Render Pipeline";
private static readonly AppData Data;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "com.readyplayerme.core",
"version": "3.2.2",
"version": "3.2.3",
"displayName": "Ready Player Me Core",
"description": "This Module contains all the core functionality required for using Ready Player Me avatars in Unity, including features such as: \n - Module management and automatic package setup logic\n - Avatar loading from .glb files\n - Avatar and 2D render requests\n - Optional Analytics\n - Custom editor windows\n - Sample scenes and assets",
"unity": "2020.3",
Expand Down

0 comments on commit 13b8af4

Please sign in to comment.