- Edited
Hello Guys,
currently I try to get my hands on Godot and I like it so far, but currently I have one problem with accessing a script that is attached to an AnimationPlayer-Node.
What I want to do: Use several AnimationPlayer and give it some extra properties like Enums that can be read out by a parent node.
What I did: Create a node with my Main-script, added a Sprite and an AnimationPlayer-Node and added a Script to the AnimationPlayer Node.
Accessing nodes works just fine and I can also access everything of my own classes but not when the Node has a Godot-functionality and an additional script is attached.
To access the node I just type in:
AnimationPlayer animPlayer = (AnimationPlayer)GetNode("name");
Then I want to access the Script and I tried
(ScriptName)animPlayer.GetScript("ScriptName");
or
(ScriptName)animPlayer.GetNode("ScriptName");
or
(ScriptName)animPlayer.GetChild(0);
In all cases I cannot acces the script.
I found a video that shows how to access Scripts with GD-Script https://www.youtube.com/watch?v=4TYh6ZLOHiU , but I cannot make it work in c#.
If you have any ideas that could help me out, I would be very greatful.
Thanks in advance.