-
-
Notifications
You must be signed in to change notification settings - Fork 21k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add root_node as property of MultiplayerAPI #40136
Add root_node as property of MultiplayerAPI #40136
Conversation
Is this really needed? This is a very advanced feature, do we really need the property? I'm worried it might confuse beginners and don't really give any advantage to advanced user. To be clear, I'm not against it, but I don't really see much usage for it. |
It's necessary when working with local networking, here is an example: remote func spawn_scene(scene : String, at_path : String):
# this works, but not with a custom root node
get_node(at_path).add_child(load(scene).instance())
# this works with a custom root node
multiplayer.root_node.get_node(at_path).add_child(load(scene).instance())
func _on_Button_pressed():
rpc("spawn_scene", "res://Bullet.tscn", multiplayer.root_node.get_path_to(bullets_node))
To make it clear: The example I showed is currently impossible, there are no workarounds. Also, I'd find a property more intuitive than a setter, but that's just my opinion. |
Maybe RPCs should use a path local to the root node, then custom multiplayer would be a lot easier and this problem would be solved. |
This is still desired. I have an addon that depends on this that has 13 Stars, so there are people who would benefit from it. |
To be clear, RPCs does send the path relative to the root node. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine for me, it just exposes an extra getter. So no reason to hold this.
Let's hope people don't get confused by it.
That's awesome! Should be documented somewhere. |
Cherry-picked for 3.2.4. |
Exposes MultiplayerAPI.root_node as a property instead of only providing the setter MultiplayerAPI.set_root_node().
If this is merged, can this be cherry picked to 3.2 as well, as it's pretty important for custom multiplayer?