Skip to content
This repository was archived by the owner on May 9, 2023. It is now read-only.

Commit 5a3cad9

Browse files
committed
Fix weird Behaviour inheritance issue
1 parent 70d67f1 commit 5a3cad9

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

src/Inspectors/GameObjectInspector.cs

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,8 @@ public void UpdateComponents()
193193
compInstanceIDs.Clear();
194194
foreach (Component comp in comps)
195195
{
196-
if (!comp) continue;
196+
if (!comp)
197+
continue;
197198
componentEntries.Add(comp);
198199
compInstanceIDs.Add(comp.GetInstanceID());
199200
}
@@ -202,8 +203,23 @@ public void UpdateComponents()
202203
behaviourEnabledStates.Clear();
203204
foreach (Behaviour behaviour in behaviours)
204205
{
205-
if (!behaviour) continue;
206-
behaviourEntries.Add(behaviour);
206+
if (!behaviour)
207+
continue;
208+
209+
// Don't ask me how, but in some games this can be true for certain components.
210+
// They get picked up from GetComponents<Behaviour>, but they are not actually Behaviour...?
211+
if (!typeof(Behaviour).IsAssignableFrom(behaviour.GetType()))
212+
continue;
213+
214+
try
215+
{
216+
behaviourEntries.Add(behaviour);
217+
}
218+
catch (Exception ex)
219+
{
220+
ExplorerCore.LogWarning(ex);
221+
}
222+
207223
behaviourEnabledStates.Add(behaviour.enabled);
208224
}
209225

0 commit comments

Comments
 (0)