Godot Quick Tip - Don't Use Load( )

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] welcome back so a pretty common scenario when using the dough is instancing scenes through code generally what you do is load the scene file from the hard drive and store that in a variable that way godot isn't loading things from disk while the game is running which can be a very slow operation that will definitely affect the frame rate if it's blocking the main thread so let's go over this example let's imagine we are making a game with lots of different dinosaurs initially we put all the dinosaurs in a dinosaurs folder as more and more dinosaurs are added we reach a point where we want to start to organize them into subfolders the problem with using the load function like this is that if we want to edit our folder structure we also need to edit the file path in every single place in our codebase this can quickly become an unmanageable endeavor fortunately there's a better way by exporting the variable we make it appear in the godot editor where we can set and edit it from here we can drag the scene file from the file system window and drop it here to the inspector window by doing it this way now as long as we move and rename the folders from here within the godot editor godot will automatically update the file paths for our variables it's a pretty simple change but it can bring huge time savings during development you don't have to worry about breaking things you can just move and rename folders at will like subscribe and as always thanks for watching you
Info
Channel: CodingKaiju
Views: 28,417
Rating: undefined out of 5
Keywords: load, preload, load()
Id: Sjgx4msCYXc
Channel Id: undefined
Length: 1min 55sec (115 seconds)
Published: Fri Mar 19 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.