I am making this little top-down shooter, and I was hoping I could add a scene for a combat room’s geometry, then drag and drop scenes from FileSystem to mix and match spawn patterns and doors. However, this has led me to realize I may not be understanding something about scenes/resources/etc.
Why can I not just @export a type, then drag and drop it into a scene? My gut tells me okay, it has to exist in the scene for this to work. That is okay, I can always just create copies of these scenes and mix and match them that way. But ideally, I can change the geometry/nodes by dragging and dropping.
Now, for pure data, like floats and ints that control spawn timers and health, I am using a custom resource I ca
n drag into the scene. But how can I do the same for things that have a “physical” presence in the Scene Tree? Stuff that has a Transform?
Thanks for any help you can provide! Here is a .gif of what I mean, please let me know if can further clarify.
not if you want to design levels inside the editor. You can have a look at GridMap, maybe this is what you are looking for
You can reference a scene from the file-system as a resource called “PackedScene”, but as i said you have to instantiate it and add it to the scene-tree manually
I did look at GridMap, but perhaps the best solution here is just to make some scenes that have modular pieces, and drop them into the scene as needed.
What I was trying to achieve was to be able to make the levels as easy as “use this floor, with this Path3D node for spawns, and these doors for after combat is done”.
I think just making these and then adding them manually to the scene will work for me. Thank you so much for the quick response and clarification!
To the point of “you need to put it in the scenetree first,” note that this can be accomplished via code as well.
Say you have a Packedscene you want to add with certain parameters determined. For example
In your current scene script:
var new_scene = preload("res://scene.tscn").instantiate()
new_scene.var_to_change = this_thing
...
add_child(new_scene)
And this new scene will be added into your scene tree with the adjustments you chose to make. But this time without manually dragging and dropping via @export.