HxGodot / hxgodot

A Haxe GDExtension for Godot 4
MIT License
232 stars 11 forks source link

Exporting property of type godot.Texture causes Null Object Reference in macro #55

Closed EliteMasterEric closed 1 year ago

EliteMasterEric commented 1 year ago
class LiquidSource extends godot.Node2D {
    @:export public var particle_texture(default, default):godot.Texture;
}

builds successfully, but causes this runtime error in Godot:

ERROR: Null Object Reference
Called from elitemastereric.physics.LiquidSource.__bindCall (godot/macros/Macros.hx line 1025)
Called from HxGodot.main (HxGodot.hx line 37)
at: elitemastereric.physics.LiquidSource:__bindCall (godot/macros/Macros.hx:1025)         
dazKind commented 1 year ago

Can you try to initialize the property?

@:export public var particle_texture(default, default) = new godot.Texture();
dazKind commented 1 year ago

Yes, see above. You need to initialize the property with a simple instance and then it will work.