-
-
Notifications
You must be signed in to change notification settings - Fork 69
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
C#: Add an easy and accessible way of organizing export variables #3451
Comments
A tool script is a script that is run in the editor, that's all. And yes, you would need to declare it as such for the See also #1255 |
What I don't get from the documentation is the next step after creating the array of properties, so one has to call |
You don't create it. The way it works is that whenever the properly list is believed to have been changed (either from internal processes or from you calling You can't define groups for Depending on how you organize things your For example (in GDScript):
Or an example with grouping from a nice plugin by Arnklit: https://github.com/Arnklit/ShellFurGodot/blob/main/addons/shell_fur/shell_fur_manager.gd It's a very powerful system, as it allows you to implement dynamic properties, changing what you display in the Inspector based on context, creating pure storage fields or pure editor-visible fields, etc. So it's worth learning even beyond grouping. |
I see, I have tried your code but I don't see changes; I have implemented your three methods and then I have called in the
What is supposed to happen after this? |
What kind of changes do you expect to see? What do you see now? By the way, when the node is initially loaded it already calls |
I respect that properties system, and I have no doubt that is a powerful system to do stuff; but this is not my proposal. My proposal is to add a extremely simple way to group exported vars, just like the Unity example that I have posted. If this can be done via this properties systems is wonderful, but I think that for most people, including myself, just adding some This is my header in the script above the exported vars that I want to group would be better, because I don't see the point in messing arround with multiple lines of code when this could be done with one single statement. I understand that with the current state of GDScript this cannot be done; then my proposal is to modify GDScript to allow it. |
In this case, this proposal is a duplicate of #1255. |
Why not export a data structure that represents the new inspector section ? A dictionnary annotated as "export" as instance ? |
Implemented by godotengine/godot#64742 and godotengine/godot#64852 |
Describe the project you are working on
I am working in a 2D platformer, but this proposal is applicable to any kind of game made within Godot.
Describe the problem or limitation you are having in your project
I have several nodes with attached scripts that contain many export variables. When the number of export variables starts to grow, it becomes harder and harder to organize them in a visible way, as there are many of them and one has to spend some seconds finding the right var in the editor.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
I know that the docs already explain how to create groups, but honestly I don't understand anything. Also, it seems that I have to state that the script is a tool, but it is not a tool, it's a regular script attached to a node, and I would like to easily organize the export vars.
So I think that to add some way of organize and add a header title to a group of variables would be helpfull.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Let's take a look at how Unity handles that:
In this example, the
SerializeField
is the equivalent of Godot'sexport var
. In this Unity script, one can easily create groups with a header using theHeader
annotation, including the name of the group within it.It would be great that something like that could be added to Godot.
If this enhancement will not be used often, can it be worked around with a few lines of script?
Based on the documentation, it seems to me like it can be worked around but not with a few lines of script. Also, the documentation does not explain clearly how to do it, in my opinion.
Is there a reason why this should be core and not an add-on in the asset library?
This should be core because organizing export vars is something that should be inherent to the workflow of creating a game. I think that it's a natural desire for a developer to organize things into things, and when you have a script that contains many many variables you start to feel the need to organize them, in the same way that we organize our project file structure, we organize our nodes...etc.
The text was updated successfully, but these errors were encountered: