10
submitted 1 year ago* (last edited 1 year ago) by Ti_Ka to c/godot@programming.dev

When i'm running more than one instance of the game, is there any quick way to tell which instance of the game is the one that gets its scene tree displayed under "Remote" in the editors scene tab?.

top 2 comments
sorted by: hot top controversial new old
[-] anteaters@feddit.de 5 points 1 year ago* (last edited 1 year ago)

It's the "first" instance that opens - on my machine it corresponds to the window order in the taskbar. The feature to configure the started instances with parameters is not yet merged into Godot 4 but I think for 3 there's an addon in the asset library to give your started instances some parameters to help you identify them.

If you just want to quickly see which window you have in the "remote" tree view, I'd suggest a quick and dirty autoload script like this:

extends Node
func _ready():
    name = str(randi_range(111,999))

    # Chill for a frame in case some other script sets the window title
    await get_tree().process_frame
    DisplayServer.window_set_title("Window: %s" % name)

Put it at the end of the autoload queue and it will create a top level node with a random-number as the name and also put that name in the window title. Note that this is for Godot 4.

Alternatively if you don't want to write the number into the window's title you can also get the name property of the autoload and write in in a label somewhere in your UI.

[-] Ti_Ka 3 points 1 year ago* (last edited 1 year ago)

Wow thanks for the quick and detailed answer :D. Ive used a variation of the autoload script you provided and it works great.

on my machine it corresponds to the window order in the taskbar.

I tried that at first too but its not very reliable on my machine and it seem they can be in any order on my taskbar.

(I actually went back and checked now that i can easily tell which one it is and it appears like it is often, but not always, the one last in my taskbar (out of 3 open instances). ~30%-50% of the time it can also be the second to last one and i recall it even being the first one in the taskbar at least once)

load more comments
view more: next ›
this post was submitted on 08 Aug 2023
10 points (100.0% liked)

Godot

6005 readers
6 users here now

Welcome to the programming.dev Godot community!

This is a place where you can discuss about anything relating to the Godot game engine. Feel free to ask questions, post tutorials, show off your godot game, etc.

Make sure to follow the Godot CoC while chatting

We have a matrix room that can be used for chatting with other members of the community here

Links

Other Communities

Rules

We have a four strike system in this community where you get warned the first time you break a rule, then given a week ban, then given a year ban, then a permanent ban. Certain actions may bypass this and go straight to permanent ban if severe enough and done with malicious intent

Wormhole

!roguelikedev@programming.dev

Credits

founded 2 years ago
MODERATORS