Skip to content

Commit 90996d7

Browse files
Fix null reference in PrefabCollectionList sync
Syncing the prefab list in OnCreated was throwing a null reference exception due to the Sync method relying on the AssetDatabase, which is not guaranteed to be in a stable state during overlay creation. Moved the sync call to OnDisplayChanged so it only runs once the editor UI is fully initialised.
1 parent 28e3926 commit 90996d7

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

Editor/Scripts/Overlays/PaletteOverlay.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ public override void OnCreated()
2626
{
2727
collapsedIcon = Resources.Load<Texture2D>($"Imgs/PaletteIcon");
2828

29-
PrefabCollectionList.Instance.Sync();
30-
3129
Instance = this;
3230

3331
gui = new PaletteGUI();
@@ -74,6 +72,7 @@ private void OnDisplayChanged(bool isDisplayed)
7472
{
7573
if (isDisplayed)
7674
{
75+
PrefabCollectionList.Instance.Sync();
7776
ToolContext.Instance.OnEnable();
7877
}
7978
else

0 commit comments

Comments
 (0)