Backgroung Loading

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Newby

i have read the docs for godot background loading but i dont really get it can someone please explain it more clearly im using the 3.0 version of godot and im not sure if the docs is updated with it

could you specify what you manged to understand and what not? Because right now you question is rather hard to answer

Bartosz | 2018-03-24 21:52

what i don understand is where i should put the code should it be for the main scene of do i load it in the auto load and where do i put the scenes that are gonna be use for the scene switching.

Newby | 2018-03-25 01:37

:bust_in_silhouette: Reply From: Bartosz

where i should put the code should it be for the main scene of do i load it in the auto load

For normal use-cases I recommend using AutoLoad. IMO using separate node as a loader is unnecessary complexity that doesn’t bring any real benefits in most common situations.

where do i put the scenes that are gonna be use for the scene switching.

Scenes used for switching should be loaded as PackedScene meaning you save them as separate scene files (those with extension .tscn) in your project. To refence them use their paths e.g. "res://scene_b.tscn"

So when you background load the new scene will be the child of the main scene?
can i put all my scene calls into one scene so i can call them globally also how can i call the background loader to my main scene do i call the entire script or do i call the functions individually when needed

Newby | 2018-03-26 12:30

background loading is just kind of loading, meaning it doesn’t modify anything. So after background loading your scene will be the same as before it is up to you what will you do with loaded scene - adding it as child, replacing main scene inserting it as a part of other node e.g. have detailed boss that is separate scene and you want it loaded only when player is in vicinity.
You are asking about scene calls in the main scene, so I assume that you decided not to use AutoLoad so the answer is yes you can put all scene call there, just remember not to accidentally replace it if one of your loaded scenes e.g. avoid get_tree().change_scene(scene_path_to_load) and get_tree().change_scene_to(loaded_scene)

Bartosz | 2018-03-26 15:47