Skip to content
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 tool internal variables in gdscript #29090

Closed
credman0 opened this issue May 21, 2019 · 2 comments
Closed

Add tool internal variables in gdscript #29090

credman0 opened this issue May 21, 2019 · 2 comments
Labels

Comments

@credman0
Copy link
Contributor

It would be useful to have a variable that tools can use to track state that can change from within the editor. For example:

func _enter_tree():
    counter+=1

_enter_tree will be called once by the editor, and then once by the game. But counter will be reset to 0 when the game is run. A flawed workaround does exist using export, ie

export var counter = 0
func _enter_tree():
    counter+=1

but this causes the variable to be editable from within the editor's Inspector, which is not ideal for a variable meant to track the internal state of the node. I request something like maybe this:

export (null) var counter = 0
func _enter_tree():
    counter+=1

which prevents the variable from appearing in the Inspector.

@2shady4u
Copy link
Contributor

2shady4u commented May 24, 2019

How about using Engine.is_editor_hint() to distinguish between counter updates? But I guess you want something more than that?
I think it is really unintuitive to have an export variable that is NOT appearing in the editor sidebar....

This is a duplicate of this btw:
#5988

@KoBeWi
Copy link
Member

KoBeWi commented May 24, 2019

Closing as duplicate of #5988

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants