You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When calling a method, that has a parameter as a resource through .rpc or .rpc_id with allow_object_decoding turned on, Godot throws an error and the method body does not execute. The error is:
"Custom_resource_name hides a global script class" even if the custom resource name is something ridiculous that clearly doesn't hide anything.
For a more detailed error please see the attached project. This error does not happen if the method is called without .rpc or .rpc_id
For those that are struggling with this Issue.
My personal best workaround is currently:
Networking class:
func _on_player_connected(id):
if multiplayer.is_server():
var path = "user://tmp.res"
ResourceSaver.save(world.world_map, path)
var file = FileAccess.open(path, FileAccess.READ)
world.set_rpc_map.rpc_id(id, file.get_buffer(file.get_length()))
Class containing the Resource:
@onready var world_map : WorldMap = WorldMap.new() : set = set_world_map
@rpc("any_peer", "call_remote", "reliable")
func set_rpc_resource(buffer):
var path = "user://tmp.res"
var file = FileAccess.open(path, FileAccess.WRITE)
file.store_buffer(buffer)
file.close()
world_map = ResourceLoader.load(path)
It'd be nice to be able to do this without creating the temporary files beforehand.
(for simple Resources inst_to_dict()/dict_to_inst() works fine too)
Godot version
4.1.1
System information
Windows 10, Windows 11
Issue description
When calling a method, that has a parameter as a resource through .rpc or .rpc_id with allow_object_decoding turned on, Godot throws an error and the method body does not execute. The error is:
"Custom_resource_name hides a global script class" even if the custom resource name is something ridiculous that clearly doesn't hide anything.
For a more detailed error please see the attached project. This error does not happen if the method is called without .rpc or .rpc_id
Tangentially Related but not the same:
#82718
#67056
#68666
Steps to reproduce
-> Make sure to run two instances
-> Play
-> Host with one instance
-> Connect with the other
-> Then press in either the send info button
Minimal reproduction project
minimal.zip
The text was updated successfully, but these errors were encountered: