0 votes

I have a control that has a bunch of buttons. I need that every button have a variable that I will assign once and never will be changed (an ID). Now I have this implemented by creating a new scene (IdButton) that ineriths from Button and has an exported var:

extends Button

export (int) var id

All my buttons are not from Button type, but IdButton type and they have a new Id variable that I can use in the editor.

There is no really a problem with that, just that I think that it's not very clean to have a new scene and a new script just to have an exported variable. Is there any better method to implement this?

in Engine by (36 points)

1 Answer

0 votes

Hi,

The Object's instance id is not suitable for what you want?

by (16 points)

No, the ID comes from a server so I have to be able to set this ID (cannot use a generated ID)

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.