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

[Suggestion] Add a constraint on UIControl.Control reference type by attribute #2579

Open
mtszkarbowiak opened this issue May 10, 2024 · 0 comments
Labels
scripting suggestion Idea or improvement suggestion ui

Comments

@mtszkarbowiak
Copy link
Contributor

(Low priority, to discuss)

The UIControl.Control indirection reduces editor's reference type checking abilities, because all script references are just UIControl. The suggestion is to add an attribute that could put type constraint on the control. Example:

[Serialize, ControlType<Button>()]
public UIControl MyGreatButton;

The editor would limit the selectable controls to only buttons and would inform a developer that the UIControl's Control type has changed type that disobeys the contraint.

@mafiesto4 mafiesto4 added suggestion Idea or improvement suggestion scripting ui labels May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scripting suggestion Idea or improvement suggestion ui
Projects
None yet
Development

No branches or pull requests

2 participants