You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+10Lines changed: 10 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
10
10
See [the roadmap](./docs/overview/roadmap.md) for details
11
11
12
+
## [3.1.4]
13
+
14
+
### Added
15
+
16
+
-**ScriptableObjectSingletonMetadata Sync Button**: Added a `Sync` button to `ScriptableObjectSingletonMetadata` inspector that re-scans all assemblies for `ScriptableObjectSingleton<T>` types and updates their metadata entries. This allows manually refreshing singleton metadata when assets are added, moved, or renamed.
17
+
18
+
### Fixed
19
+
20
+
-**ScriptableObjectSingletonCreator race condition**: Fixed issue where newly created singleton assets were immediately deleted because `LoadAssetAtPath` returned null before Unity's AssetDatabase had indexed the file. The fix adds a synchronous import after `CreateAsset` and avoids deleting on-disk files when the file exists but isn't visible to the AssetDatabase yet.
$"ScriptableObjectSingletonCreator: Asset file created at {targetAssetPath} but not yet visible to AssetDatabase. Will retry."
333
-
);
334
-
}
335
-
else
336
-
{
337
-
Debug.LogError(
338
-
$"ScriptableObjectSingletonCreator: CreateAsset appeared to succeed but asset not found at {targetAssetPath}. This may indicate a stale asset database state."
340
+
$"ScriptableObjectSingletonCreator: Asset file created at {targetAssetPath} but not yet visible to AssetDatabase. Will retry without deleting the file."
339
341
);
342
+
// DON'T call SafeDestroyInstance here - the file is valid, just not imported yet.
343
+
// Only destroy the in-memory instance without touching the on-disk file.
344
+
try
345
+
{
346
+
Object.DestroyImmediate(instance,true);
347
+
}
348
+
catch(Exceptionex)
349
+
{
350
+
LogVerbose(
351
+
$"ScriptableObjectSingletonCreator: Failed to destroy in-memory instance: {ex.Message}"
352
+
);
353
+
}
354
+
retryRequested=true;
355
+
continue;
340
356
}
341
-
// Use allowDestroyingAssets=true because CreateAsset may have partially succeeded,
342
-
// associating the instance with an asset even though LoadAssetAtPath returns null.
357
+
358
+
Debug.LogError(
359
+
$"ScriptableObjectSingletonCreator: CreateAsset appeared to succeed but asset not found at {targetAssetPath}. This may indicate a stale asset database state."
360
+
);
361
+
// File doesn't exist on disk - this is a real failure, clean up
343
362
SafeDestroyInstance(instance,targetAssetPath);
344
363
retryRequested=true;
345
364
continue;
@@ -348,10 +367,7 @@ ref anyChanges
348
367
LogVerbose(
349
368
$"ScriptableObjectSingletonCreator: Created missing singleton for type {derivedType.FullName} at {targetAssetPath}."
0 commit comments