The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

+1 vote

Hi, i couldn't find a satisfying answer and after reading the Q&A i will jump directly into the question:

Code snippet:

const Tool : PackedScene = preload("res://scene/tool_0.tscn")

When i move the file "tool_0.tscn" via "Move To.." the code path will not be updated.

To fix this i used the next snippet (Drag & Drop the "tool0.tscn" in the editor) so i can move the "tool0.tscn" file around as i want.

export (PackedScene) var Tool : PackedScene = null

At last i made an export Array, defined every element of it as an object in the editor and moved some Scene files via Drag & Drop into it.

export (Array) var Tool : Array = []


  1. Is there a way to define an Array as "PoolObjectArray",
    "PackedSceneArray" or something like that?
  2. I can't use "preload" in "export", does this impact performance?
  3. I read through many topics like best practice, code architecture, dynamic resources etc., but could not find a good answer. Is there a reason not to handle it like that?
Godot version 3.2.3.stable.official
in Engine by (24 points)
export (Array, PackedScene) var my_array

Is that what you looking for?

Yes, that was what i searched for!
I will not change the "Best answer" because i think it has some good additional information.
But if someone has the same question regarding the Array, this is the correct solution!

1 Answer

0 votes
Best answer
  1. No, you can not specify the type of what the Array holds. There are a few Pool...Array, but they act differently than regular Arrays.
  2. load and preload are just as slow as one another. The only performance difference, is that if you call load during gameplay and the Resource has not already been loaded, the player will notice a stutter. To avoid that, try loading the Resource a first time outside of gameplay, like when the Scene is loaded.
  3. Do not get too fixated with "best practices" and try to evaluate pros and cons yourself. I see two issues with this approach:
  • Renaming the exported array will wipe the data contained inside them project-wide.
  • You need to be careful to always make a new Array when filling one for a different object, as the default Array when exporting will be shared by default (: Array = null would fix this).

Instead of exporting an Array directly, if you want to save the content of the Array to disk in a separate file, you could make a custom Resource (set a class_name and export an Array).

You should avoid having variable names begin with an uppercase, this is usually reserved for the name of classes.

by (2,720 points)
selected by

This answered all of my questions!
Also very good additional information.
I appreciate every improvment i can get.
Probably i should stop to overthinking things.
Hopfully this was an acceptable question, there will probably be more in the future.

Thank you and i wish you a very nice day!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.