![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | godotisgreat |
I am quite confused with the answer above as I do not understand how the code works:
Where do i type the following code into?
Which Node should I create the script into?
What exactly should I do if this piece of code doesn’t work?
I really appreciate your answers and I am hoping for you to find a solution to this as quick as possible!
P.S. Thank you to whoever spends their precious time trying to find a solution for us, It really helps! (When I mean ‘us’, I mean every person who you have spent your time on)
Here is the answer that I saw:
var screen_size = OS.get_screen_size(screen=0)
var window_size = OS.get_window_size()
OS.set_window_position(screen_size*0.5 - window_size*0.5)
godotisgreat | 2022-10-02 17:14
Call this code in the _onready() of your first node.
SteveSmith | 2022-10-02 17:59
Placing it into an autoload would be good place, this way it’s not dependent of which scene was run. Just created a script for Node, and add the code to func _ready():
. Add this script to Project Settings
/ AutoLoad
.
But check also the other method I mentioned in my actual answer.
aXu_AP | 2022-10-04 17:56
Thank you for your responses!
godotisgreat | 2022-10-13 16:41