-
-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Save non exported variables in PackedScenes #761
Comments
If I understand you correctly, yeah it's not possible to export a specific resource type, but you can export a generic resource (to which you can pass your custom one): export(Resource) var custom_resource
I've experimented a bit, and figured it's actually quite possible to make existing properties "exportable" while having them hidden in the editor, but requires low-level API: tool
extends Node2D
var member = 10
func _get_property_list():
var serializable = [
{
name = "member",
usage = PROPERTY_USAGE_NOEDITOR,
type = TYPE_INT,
}
]
return serializable If you save this script with the scene and look at the contents of the
This could probably be added to GDScript exports page (once we get to merge godotengine/godot-docs#3444 😛). I'm not sure if this hacky enough, because you can expose the same member twice with |
see things like this need to be supported better.
everywhere serialization and exposing it to the inspector should NOT be the same thing. |
Yeah, I hope that many of the not-so-common hidden features could be made available via GDScript annotations, at least to some extent: godotengine/godot#20318. |
Related discussion: godotengine/godot#5988. Specifically the suggestion to use |
Describe the project you are working on:
A 3D Tower defense game that requires saving a node with a grid
Describe the problem or limitation you are having in your project:
current gridmaps only work for meshes so made my own grid class (not node) and tried to save a node with a reference to it at runtime as a packed scene.
to my surprise I found out godot doesn't support saving variables in packed scenes unless they are exported and custom classes can't be exported.
this forces developers to export everything even if they want to have it hidden.
which in this case isn't even possible.
Describe the feature / enhancement and how it helps to overcome the problem or limitation:
I suggest that all variables/properties are saved in packed scenes or at least give us a way to mark them as serializable
this allows people like myself to save custom classes in packed scenes without resorting to json and not having to export them later when its supported
Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:
either allow us to use a serializable keyword or just save the entire scene and its state including its non exported variables
If this enhancement will not be used often, can it be worked around with a few lines of script?:
right now data oriented design is horrible in godot and we can't do much at all without making everything a node. this would be used everytime someone saved a packed scene
and i don't know of a way to work around this. but let me know if you do.
Is there a reason why this should be core and not an add-on in the asset library?:
because we shouldn't have to have everything as a node in godot and currently like I said data oriented design is horrible in godot
The text was updated successfully, but these errors were encountered: