1
0
mirror of https://github.com/originalnicodr/CinematicUnityExplorer.git synced 2026-10-10 04:53:15 +08:00

Added checks to avoid interacting with some panel cells related to already deleted objects.

This commit is contained in:
originalnicodr
2024-03-08 20:38:46 -03:00
parent 4b971d8191
commit 7046d8b5cd
2 changed files with 14 additions and 1 deletions
+1
View File
@@ -146,6 +146,7 @@ namespace UnityExplorer.UI.Panels
string check = animatorPlayer.animator.name;
}
catch {
FindAllAnimators();
return;
}
+13 -1
View File
@@ -66,6 +66,18 @@ namespace UnityExplorer.UI.Panels
}
GameObject light = CreatedLights[index];
// Check if the light was deleted because we switched scenes, and delete it from the list if that's the case
try {
string check = light.name;
}
catch {
ExplorerCore.LogWarning("Light was deleted by the game!");
CreatedLights.RemoveAt(index);
lightsScrollPool.Refresh(true, false);
return;
}
cell.light = light;
cell.label.text = light.name;
}
@@ -132,7 +144,7 @@ namespace UnityExplorer.UI.Panels
private void CreateLight(LightType requestedType){
GameObject obj = new($"CUE - Light {lightCounter}");
//DontDestroyOnLoad(obj);
GameObject.DontDestroyOnLoad(obj);
obj.hideFlags = HideFlags.HideAndDontSave;
Light lightComponent = obj.AddComponent<UnityEngine.Light>();
lightComponent.type = requestedType;