Specify Type of PackedScene in Array

Godot Version

4.4

Question

I have an Array of packed Scenes I want to instantiate.

@export var plant_scenes: Array[PackedScene]

All of the Scenes in this array are supposed to be of the type “Plant”
(their scripts all inherit from Plant)
Is there a way I can make sure only this type of scene can be put into the array?
I cannot do this because it would not give me Packed Scenes.

@export var plant_scenes: Array[Plant]

I would need something like this but this doesnt work:

@export var plant_scenes: Array[PackedScene : Plant]

Thanks for your help :grinning:

It’s not possible. All scenes are PackedScene Resources that’s their type.

1 Like

Ok thanks for you help :grinning:
It would be a cool feature to add then.