Replies: 1 comment 11 replies
-
This is trivial to do with a few lines of code, and I don't think there's a strong demand for this as a simple, built-in feature with limited configurability, much better to be done in a way that's the way you want it done and not being bound by how the engine decides it should be done If nothing else this belongs in an add-on not in core I do this myself in my own projects, as simple as: @export var asteroid_scenes : Array[PackedScene]
...
var asteroid : RigidBody2D = (asteroid_scenes.pick_random() as PackedScene).instantiate() If you want a weighted result just use |
Beta Was this translation helpful? Give feedback.
11 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
In godot, the AudioStreamRandomizer resource is very useful because it allows you to:
PackedSceneRandomizer & ResourceRandomizer
This concept is practical and makes particular sense for audio, but I'd like to discuss here the idea of replicating this concept for other types of elements, starting with PackedScene and Resource.
Just to give you some examples where I'd like something similar:
Loot example
Using the loot example, I would have chest.tscn with a property:
@export var loot:PackedScene
And I could choose to assign it a PackedScene or a PackedSceneRandomizer.
I could have multiple loot list resources which would each contain different scenes:
But also lists that contain multiple lists with different weights:
Same thing could probably be applied to the Resource with a ResourceRandomizer.
Technically all of this is already doable with custom resources, but in practice nothing is as ideal as something like AudioStreamRandomizer, As with the AudioStreamRandomizer, the idea is to offer a practical and quick-to-implement tool that meets a number of use cases while not replacing more complex custom solutions for rarer cases.
I can imagine that the idea is technically more complicated in the case of scenes and resources compared to sounds or that it poses certain problems but in any case I would like to confront the idea here and see if there is a world where it could exist, because it would be very useful to me.
Beta Was this translation helpful? Give feedback.
All reactions