Why is 'instance is Spatial' returns false when GetType() returns Spatial in C#?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Lajbert

Hey,

I have a scene that looks like the following:

Root [Spatial]
  +--- Child_1 [MeshInstance]
  +--- Child_2 [MeshInstance]

When I instantiate the scene, I want to cast it to Spatial, but I get an exception saying it can’t be casted as it’s not spatial.
The following code confirms that the object is spatial:

GD.Print(child.Name + ", type: " + child.GetClass() + ", is it Spatial? " + (child is Spatial));

Output:

SpikeTrap, type: Spatial, is it Spatial? False

The GetClass() clearly returns ‘Spatial’, so why is ‘child is Spatial’ false?

Thanks

:bust_in_silhouette: Reply From: Lajbert

Found the issue: I’m was dumb.
Although in the UI, the type really was spatial, the script attached to the scene was inherited from Node, and not Spatial.