Skip to content

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

Open

Description

@yuyu0127

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions