I'm trying to send a custom class InvItem
through a signal _UpdateHotbarItem
. When the signal is declared as this in the Inventory.cs class:
[Signal]
public delegate void _UpdateHotbarItem(string id, int index, bool side, string data);
it's fine. However, when I add InvItem item
to the parameters and build the project, the signal disappears from the signal list in the editor and I get a couple errors. On startup, I get _get_signal: Unknown type of signal parameter 'item' in 'Inventory'
. On signal connection, I get connect: In object of type 'Area2D': Attempt to connect nonexistent signal '_UpdateHotbarItem' to method 'KinematicBody2D.UpdateHotbarItem
, and on emitting the signal, I get two more errors, Attempted to convert an unmarshallable managed type to Variant. Name: 'InvItem' Encoding: 18
, and Can't emit non-existing signal "_UpdateHotbarItem".
When I remove the InvItem item
, and change the signal emitters and receiving methods, all four of those errors disappear.
In both cases, the InvItem export I have, shown here:
[Export]
InvItem heldItem = null;
throws an error, this error being _get_member_export: Unknown exported member type: 'Inventory.heldItem'.
It seems to me that Godot doesn't realize the InvItem
class in the CustomDataTypes
namespace in CustomDataTypes.cs
exists. How do I get Godot to recognize it, so I can use it in signals, export statements, and similar things?