Files
godot-demo-projects/networking/websocket_multiplayer/script/combo.gd
Fabio Alessandrelli da12c09942 [Net] Update WebSocket multiplayer demo.
Updated to Godot 4.

Added combo (default) scene showing dedicated multiplayer branches
(i.e. running both server and clients in the same SceneTree).
2022-09-29 21:13:55 +02:00

17 lines
452 B
GDScript

extends Control
var paths := []
func _enter_tree():
for ch in $GridContainer.get_children():
paths.append(NodePath(str(get_path()) + "/GridContainer/" + str(ch.name)))
# Sets a dedicated Multiplayer API for each branch.
for path in paths:
get_tree().set_multiplayer(MultiplayerAPI.create_default_interface(), path)
func _exit_tree():
# Clear the branch-specific Multiplayer API.
for path in paths:
get_tree().set_multiplayer(null, path)