Fix static initialization of godot binding classes
dazKind opened this issue · 3 comments
dazKind commented
static var test : godot.variant.StringName = "crash";
will crash since Haxe's static initialization happens before Godot-Classes are registered. We need to some macro handler to deal with these static fields and do the initialization upon successful class registration
dazKind commented
For the moment we added a compiler warning, but we want a proper handler for this
dazKind commented
Should be fixed in 9ea230a
We run a custom routine now.
package example;
import godot.variant.StringName;
import godot.variant.NodePath;
class HxOther extends godot.Node {
// the following will use new static initialization routine
static var someStringName:StringName = "test2";
static var someNodePath = new NodePath();
override function _ready() {
trace(someStringName);
}
}
dazKind commented
Review in case of ScriptLanguageExtension