Skip to content

Commit 13b8af4

Browse files
Hotfix/fix core settings (#123)
### Fixed - issue where order of operations caused scriptable object creation errors
1 parent 75623c9 commit 13b8af4

File tree

8 files changed

+25
-19
lines changed

8 files changed

+25
-19
lines changed

.github/latest.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,4 @@
22
## Changelog
33

44
### Fixed
5-
- 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)
6-
7-
5+
- an issue causing settings to be recreated when not needed @harrisonhough in [#123](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/123)

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
All notable changes to this project will be documented in this file.
44
This project adheres to [Semantic Versioning](http://semver.org/).
55

6+
## [3.2.3] - 2023.09.11
7+
### Fixed
8+
- an issue causing settings to be recreated when not needed @harrisonhough in [#123](https://github.com/readyplayerme/rpm-unity-sdk-core/pull/123)
9+
610
## [3.2.2] - 2023.09.07
711

812
### Fixed

Editor/BuildPostProcessor.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@ public static class BuildPostProcessor
1111
public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject)
1212
{
1313
// create asset if it has been deleted
14-
if (CoreSettingsHandler.CoreSettings == null)
15-
{
16-
CoreSettingsHandler.CreateCoreSettings();
17-
}
14+
CoreSettingsHandler.EnsureSettingsExist();
1815
AppData appData = ApplicationData.GetData();
1916
AnalyticsEditorLogger.EventLogger.LogBuildApplication(appData.BuildTarget, PlayerSettings.productName, !Debug.isDebugBuild);
2017
}

Editor/Module Management/ModuleInstaller.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ static ModuleInstaller()
6161

6262
private static void DelayCreateCoreSettings()
6363
{
64-
CoreSettingsHandler.CreateCoreSettings();
6564
EditorApplication.delayCall -= DelayCreateCoreSettings;
65+
CoreSettingsHandler.EnsureSettingsExist();
6666
}
6767

6868
/// <summary>

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ After the process is complete you project will have imported these packages:
9292
}
9393
],
9494
"dependencies": {
95-
"com.readyplayerme.core": "3.2.2"
95+
"com.readyplayerme.core": "3.2.3"
9696
}
9797
}
9898
```

Runtime/CoreSettingsHandler.cs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,14 @@ public static CoreSettings CoreSettings
1414
{
1515
get
1616
{
17+
if (coreSettings != null) return coreSettings;
18+
coreSettings = Resources.Load<CoreSettings>(RESOURCE_PATH);
19+
#if UNITY_EDITOR
1720
if (coreSettings == null)
1821
{
19-
coreSettings = Resources.Load<CoreSettings>(RESOURCE_PATH);
20-
#if UNITY_EDITOR
21-
if (coreSettings == null)
22-
{
23-
coreSettings = CreateCoreSettings();
24-
}
25-
#endif
22+
coreSettings = CreateSettings();
2623
}
24+
#endif
2725
return coreSettings;
2826
}
2927
}
@@ -49,7 +47,16 @@ public static void Save()
4947
AssetDatabase.SaveAssets();
5048
}
5149

52-
public static CoreSettings CreateCoreSettings()
50+
public static void EnsureSettingsExist()
51+
{
52+
coreSettings = Resources.Load<CoreSettings>(RESOURCE_PATH);
53+
if (coreSettings == null)
54+
{
55+
coreSettings = CreateSettings();
56+
}
57+
}
58+
59+
private static CoreSettings CreateSettings()
5360
{
5461
DirectoryUtility.ValidateDirectory($"{Application.dataPath}/{SETTINGS_SAVE_FOLDER}");
5562
var newSettings = ScriptableObject.CreateInstance<CoreSettings>();

Runtime/Data/ApplicationData.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace ReadyPlayerMe.Core
66
{
77
public static class ApplicationData
88
{
9-
private const string SDK_VERSION = "v3.2.2";
9+
private const string SDK_VERSION = "v3.2.3";
1010
private const string TAG = "ApplicationData";
1111
private const string DEFAULT_RENDER_PIPELINE = "Built-In Render Pipeline";
1212
private static readonly AppData Data;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "com.readyplayerme.core",
3-
"version": "3.2.2",
3+
"version": "3.2.3",
44
"displayName": "Ready Player Me Core",
55
"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",
66
"unity": "2020.3",

0 commit comments

Comments
 (0)