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

Request to apply attributes on list field to each individual element #66

Open
yuyu0127 opened this issue Mar 16, 2024 · 0 comments
Open

Comments

@yuyu0127
Copy link
Contributor

yuyu0127 commented Mar 16, 2024

I've encountered an issue where attributes applied to list fields do not work as expected for each element within the lists. Specifically, attributes like [Required] and [AssetsOnly] seem to have no effect on the elements of the lists.

Example Code

[Required] // This attribute does not work as expected
public List<Object> requiredList;

[AssetsOnly] // This attribute does not work as expected
public List<Object> assetsOnlyList;

Expected Behavior

I expect the [Required] attribute to ensure that each element within the list is not null. Similarly, the [AssetsOnly] attribute should validate that each list element refers to an asset only.

Actual Behavior

The attributes seem to only apply to the list field itself and do not enforce the expected constraints on the individual elements within the list.

Request

I request a feature enhancement that allows these attributes to be applied effectively to each element within a list, ensuring that each element adheres to the specified constraints.

Note

Odin Inspector seems to use a [DontApplyToListElements] attribute to indicate that an attribute should be applied to the list itself, not to each element within the list.

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

No branches or pull requests

1 participant