Godot 4.1 .net/C# - New [GlobalClass] attribute not working

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

I am currently trying new features of version 4.1 (.net). A particularly nice one is the new [GlobalClass] attribute that makes C# classes available in the node selection.

Unfortunately, this does not work here, for example:

public interface IEntity { }

[GlobalClass]
public partial class Entity : Node { }

[GlobalClass]
public partial class EntityCharacterBody2D : CharacterBody2D, IEntity { }

[GlobalClass]
public partial class EntityNode2D : Node2D, IEntity { }

No class appears in the node selection, even after restarting the editor.

Before I open a bug, I wanted to ask if anyone has had other experiences?

I am working on Win11 with Visual Studio Community 2022 version 17.6.4

:bust_in_silhouette: Reply From: Hralok

Hello, for me it’s working correctly. Just in case, did you build your c# project after adding [GlobalClass] to your class? And, have you tried to find your class when selecting a node using the search function? I was in a test project when I tried this new functionality, at first I also could not find where my class marked as global is located, but after a few minutes of searching with my eyes, I found it in a completely non-obvious place, not where it should be according to inheritance logic. However, after a few more tests, I figured out that if you have two classes A and B, with class A inherits from some Godot Node, and class B from class A, and at the same time class B is marked as GlobalClass and A is not, then class B in the node selection will appear at the top level of the selection nodes, along with Viewport, CanvasItem and others. However, if both classes A and B are labeled as Global Class, then they will appear in the node selection hierarchy with the correct inheritance chain