MultiplayerSpawner custom spawn errors

Godot Version

4.3

Question

I’m having issues using the custom spawn functionality for the multiplayer spawner. There isn’t much documentation on how it should be used, maybe somebody could enlighten me?

I set the spawn function in _ready(), then the server spawns the item in drop_item(). The item spawns correctly on the server but the clients return these two errors:

E 0:00:10:0585   instantiate_custom: Failed to call spawn function.
  <C++ Error>    Condition "ce.error != Callable::CallError::CALL_OK" is true. Returning: nullptr
  <C++ Source>   modules/multiplayer/multiplayer_spawner.cpp:315 @ instantiate_custom()
E 0:00:10:0585   on_spawn_receive: Parameter "node" is null.
  <C++ Source>   modules/multiplayer/scene_replication_interface.cpp:621 @ on_spawn_receive()



func _ready():	
	get_node("/root/Game/WorldSpawner").set_spawn_function(item_setup)
func drop_loot():
	if multiplayer.is_server():		
			for item_drop_data in drop_data.items:
				if randf() <= item_drop_data.item_drop_rate:
					print("drop")
					drop_item(item_drop_data, global_position)


func drop_item(item_drop_data: ItemDropData, position: Vector3):
	get_node("/root/Game/WorldSpawner").spawn(item_drop_data.item_data)
	

func item_setup(item_data: ItemData) -> Node3D:
		var scene = load("res://Inventory/ItemDrops/ItemDrop.tscn")
		var instance = scene.instantiate() as Node3D
		instance.setup(item_data)
		#instance.global_position = position
		return instance

There is barely any information I have found online in actually how to use these functions so if anybody knows any more that would be a great help.

thanks

I think the return signature needs to be -> Node and not -> Node3d

It could also be ItemData class is not allowed because it may have code. And by default that is not allowed to be passed, unless you changed the project settings.