- Edited
Having trouble with getting a script off of a node.
The following is my current code. I have a PlayerController
script attached to the example
node, which is named "Player". Yet I can find no way to access the script itself, to get any variables, public methods, etc.
I am going to use this to run a method defined by an Interface.
[Tool]
public partial class GizmoDrawer : Node
{
[Export] Node example;
public override void _Process(double delta)
{
GD.Print(example.Name);
GD.Print(example.GetScript().As<CSharpScript>().ResourcePath);
GD.Print(example is PlayerController);
}
}
Console Output
Player
res://Scripts/PlayerController.cs
False
The console output indicates that the script is definitely attached, but I can't find anyway to access the instance of it through code.