-
-
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
Add a property to make a node visible only in the editor or in the running project #3433
Comments
It should be noted that the proposal says "to make a node not visible in a game". That is, it seems to revolve around the idea of hiding such nodes at runtime, means they will still be there. So when the property is called If using solely "visibility" is really what is wanted, then it should be precised that the node will still be there. I would be interested in having such nodes stripped on export, but maybe other people want the node to remain present. |
Thanks @Calinou. An option to completely remove the node at runtime would be nice. Sometimes we will want optional visibility, this can be easily accomplished with code, but sometimes it might be useful to ignore "editor-only" nodes completely and that's not totally feasible. We can remove the node only after it has been loaded and has taken resources up. Maybe it should be called |
What about replacing the eye by a drop-down list with these three options? |
Being able to toggle visibility with a simple click is important, so a drop-down menu wouldn't be a good idea here. (Unless you're referring to displaying a drop-down menu only when the user right-clicks the eye icon, that is.) |
That was not my initial idea but I find it great. |
I played with this idea a bit. In my take the In my opinion, "runtime only" nodes are not that common, and can be trivially implemented by instancing in gdscript, or by hiding using My implementation: gaudecker/godot@daaf711 |
@gaudecker Out of curiosity, did you see godotengine/godot#56446?
I agree this can be done trivially with a script that sets |
I did find it right after I posted the above comment. 😁 It seems to have the same approach. |
Using Also, is that macOS issue reported somewhere already? |
Upon further testing I'm unsure if it actually is a bug. I just submitted it anyways in case it technically is. godotengine/godot#59743 |
If an "Editor only" node will be still in tree, that means I want to make it visible sometime during the game. Or idk why I want it in the tree. |
Sometimes I use nodes as anchor points. The game uses their position and maybe some other property but without being visible. In the editor I want to see them and move them around. This is very useful to change the behavior of the game and entities in a visual way. |
Doesn't tool + Engine.is_editor_hint() solve that? |
Also it seems this property becomes useless as soon as the game starts. |
And it solves only a particular problem — node visibility. Looks like the more general problem is that we want something like tool+Engine.is_editor_hint() but more declarative, that could be set up right in the editor, without code. |
Unreal Engine has this feature. In addition to the 'Visible in game' checkbox (equivalent of our 'Visible' checkbox) they also have 'Visible in Engine'. Having both checkboxes allows you to see everything in your scene while developing, but have it hidden by default as the game fires up without need for a script to do it. Very convenient. |
Even unity has an EditorOnly tag that marks objects as stripped from builds, maybe godot could use its groups for this too (a special Remove/StripFromBuilds group or similar). This would atleast not require another property on objects or more checkboxes. |
This would be a great feature. To add to the list of how it can be useful: |
Describe the project you are working on
The Godot editor 🙂
Describe the problem or limitation you are having in your project
Making a node effective only in the editor (or only in the running project) currently requires using a script.
There are a few exceptions to this (such as Light3D with its Editor Only property), but I feel a more generic solution is needed here.
#1835 didn't address this, since it was about disabling nodes both in the editor and running project.
This proposal is only about node visibility, not processing. If you wish to avoid unnecessary processing in nodes when they're hidden, use
if is_visible_in_tree()
to early-abort in your script's_input()
/_process()
/_physics_process()
functions.Describe the feature / enhancement and how it helps to overcome the problem or limitation
Add a property to make a node visible only in the editor or in the running project.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Add a property to Node2D, Node3D and Control that controls visibility depending on the current engine operation:
Since this toggles visibility, parents' properties are implicitly inherited.
Light3D's Editor Only property can be deprecated (and hidden from the inspector if it's
false
) after adding the above property.If this enhancement will not be used often, can it be worked around with a few lines of script?
This can be worked around in at least two ways:
Is there a reason why this should be core and not an add-on in the asset library?
Since making nodes visible only in the editor or running project is a relatively common operation in a polished game, it makes sense to have this as a core feature.
The text was updated successfully, but these errors were encountered: