diff --git a/src/Inspectors/GameObjectInspector.cs b/src/Inspectors/GameObjectInspector.cs index e179601..a696f66 100644 --- a/src/Inspectors/GameObjectInspector.cs +++ b/src/Inspectors/GameObjectInspector.cs @@ -193,7 +193,8 @@ namespace UnityExplorer.Inspectors compInstanceIDs.Clear(); foreach (Component comp in comps) { - if (!comp) continue; + if (!comp) + continue; componentEntries.Add(comp); compInstanceIDs.Add(comp.GetInstanceID()); } @@ -202,8 +203,23 @@ namespace UnityExplorer.Inspectors behaviourEnabledStates.Clear(); foreach (Behaviour behaviour in behaviours) { - if (!behaviour) continue; - behaviourEntries.Add(behaviour); + if (!behaviour) + continue; + + // Don't ask me how, but in some games this can be true for certain components. + // They get picked up from GetComponents, but they are not actually Behaviour...? + if (!typeof(Behaviour).IsAssignableFrom(behaviour.GetType())) + continue; + + try + { + behaviourEntries.Add(behaviour); + } + catch (Exception ex) + { + ExplorerCore.LogWarning(ex); + } + behaviourEnabledStates.Add(behaviour.enabled); }