0 votes

You would normally export PackedScene as
export(PackedScene) var scene = preload('...')

But I want to categorize the variable, so I advance export it.

func _get_property_list() -> Array:
return [
    {
        name='scene',
        type=TYPE_OBJECT
    }
]

The thing is.. there is no TYPE_PACKEDSCENE. I tried to export as TYPE_OBJECT, It just exports all objects. Image

This also happens to every kind of export that TYPE_ doesn't have. Please, let me know if there is any better way for better categorizing export or it is coming for gdscript 4.0.

Godot version 3.3.2.stable
in Engine by (80 points)

1 Answer

+1 vote
Best answer

You need to use a property hint for that:

{
    name = "asdasd",
    type = TYPE_OBJECT,
    hint = PROPERTY_HINT_RESOURCE_TYPE,
    hint_string = "PackedScene"
}
by (1,517 points)
selected by

Thanks. Can I ask where did you know these? I can't find this anywhere on the docs.

Thanks for the source! This getting a lil deep

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.