mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2026-01-05 07:20:07 +01:00
Updated to Godot 4. Added combo (default) scene showing dedicated multiplayer branches (i.e. running both server and clients in the same SceneTree).
17 lines
452 B
GDScript
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)
|