The Godot Community Forums are back up and running! Please read the the announcement post for important information on what happened. Thanks!

(Mono) How instanciate custom class as Node?

boruokboruok Posts: 18Member
edited September 10 in Programming

Let's say i have following setup:

// State.cs
public class State: Node {}

// Walk.cs
public class Walk : State {}

// StateMachine.cs
public override void _Ready()
var node = new State();
node.Name = "WalkState";

class methods _ready, _process, _physics_process isn't beign executed. why?
but if i call class name itself, everything works.

var node = new Walk();

is here any way to instanciate class by name? lets say i have array with string names:
{"walk", "stand", "jump"}

Best Answer


Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file