From dca283f02bf460e4979f0e5c2809df8c6221f12e Mon Sep 17 00:00:00 2001
From: MaZiFAU <63099053+MaZiFAU@users.noreply.github.com>
Date: Tue, 23 Apr 2024 19:33:27 +0200
Subject: [PATCH] Minor Bugfix when restarting Stage

---
 Assets/Resources/Prefabs/UI/Facts/Factscreen.prefab | 2 +-
 Assets/Scripts/InventoryStuff/DisplayFacts.cs       | 8 +++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/Assets/Resources/Prefabs/UI/Facts/Factscreen.prefab b/Assets/Resources/Prefabs/UI/Facts/Factscreen.prefab
index 7b119fb2..8addc4b7 100644
--- a/Assets/Resources/Prefabs/UI/Facts/Factscreen.prefab
+++ b/Assets/Resources/Prefabs/UI/Facts/Factscreen.prefab
@@ -507,7 +507,7 @@ RectTransform:
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0, y: 1}
   m_AnchorMax: {x: 1, y: 1}
-  m_AnchoredPosition: {x: 0, y: 0}
+  m_AnchoredPosition: {x: 0, y: -180}
   m_SizeDelta: {x: 0, y: 0}
   m_Pivot: {x: 0.5, y: 1}
 --- !u!114 &8823539307371861913
diff --git a/Assets/Scripts/InventoryStuff/DisplayFacts.cs b/Assets/Scripts/InventoryStuff/DisplayFacts.cs
index 9070aa63..203aa055 100644
--- a/Assets/Scripts/InventoryStuff/DisplayFacts.cs
+++ b/Assets/Scripts/InventoryStuff/DisplayFacts.cs
@@ -69,11 +69,16 @@ public void OnAfterDeserialize()
     {
         _PrefabDictionary = new();
         for (int i = 0; i != Math.Min(PrefabtTypeReadonly.Count, PrefabDataConfig.Count); i++)
-            // if (PrefabDataConfig[i] != null)
+        {
+            //// No Idea how to reproduce
+            //if (TypeExtensions<Fact>.UAssemblyInheritenceTypes.FirstOrDefault(type => type.ToString() == PrefabtTypeReadonly[i]) == null)
+            //    continue;
+
             _PrefabDictionary.TryAdd(
                 TypeExtensions<Fact>.UAssemblyInheritenceTypes.FirstOrDefault(type => type.ToString() == PrefabtTypeReadonly[i]),
                 PrefabDataConfig[i]
             );
+        }
     }
     #endregion ISerializationCallbackReceiver
 
@@ -81,6 +86,7 @@ public void OnAfterDeserialize()
     void Awake()
     {
         Instance = this; //first come, first serve
+        displayedFacts = new(); // reset static properties
     }
 
     private void OnEnable()
-- 
GitLab