HxGodot/hxgodot

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

EliteMasterEric opened this issue · 2 comments

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)         

Can you try to initialize the property?

@:export public var particle_texture(default, default) = new godot.Texture();

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