How to get the `CSharpScript` of itself in a .cs file?

Godot Version

4.3-mono

Question

How to get the CSharpScript of itself in a .cs file?
Such as:

public partial class A: GodotObject
{
    static A(){
        // now how to get that without instantiate the A
        new A().GetScript();
    }
}

Hello,

You cannot use non static methods/ properiets/ fields from static methods.

To solve this problem, maybe you can use the singleton pattern.

His class is not static.
This maybe can helps
CallerFilePathAttribute

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.