A Godot addon that adds access modifiers to exported variables in scenes. This can be used to prevent changes to exported variables that are only meant to be modified in the base scene or reduce clutter from the inspector.
- Install the addon from the AssetLib.
- Activate the plugin from Project Settings > Plugin.
- Navigate to the root node of a scene and the inspector will now contain access modifier buttons.
- Update exports access modifier to
Private
orProtected
- Navigate to a tree where the scene is instantiated. The
Private
exports will now be hidden!
Q: Why aren't the access modifiers updating when I updated the script?
A: Since these are stored as metadata in the scene, sometimes the loaded scene may go out of sync with the file. Try saving and reopening the scene to see if it resolves the issue.
Q: Why don't I see the access modifier buttons?
A: Make sure you're at the root node of a scene. Since only root node exports are visible in other scenes, only these variables can have access modifiers.
Q: Why are access modifiers from one scene not the same as another scene with the same script?
A: The addon is designed around scenes, not scripts. Scenes can be treated as "classes" and scenes in other trees are treated as "instances". This is the reason Protected
variables apply to inherited scenes, not inherited scripts. If you are looking for an addon that hides properties based on scripts, check out Hide Private Properties, which hides properties that begins with an underscore.
Public
: Public exports are always visible.Private
: Private exports are only visible in the base scene.Protected
: Protected exports are only visible in the base scene and its inheritors.
Actor.tscn | Player.tscn (extends Actor) | Level.tscn |
---|---|---|
Private and protected exports can be used to fine-tune how exports are shown in other scenes.
Setting | Description | Default |
---|---|---|
Display Mode | Always : modifier always shown Selected : only shown on selected properties Modified : only shown on modified and selected properties |
Always |
Most testing is done by gdUnit4. However, testing is_overwriting_default
is not possible with gdUnit because it uses Script.get_property_default_value
, which only works in the editor. To cover this, extra tests has been writen as an EditorScript in test/manual_test.gd
.