Skip to content

Create auto queries #2

Description

@DarkRewar

Allow ui elements to be automatically retrieved at awake/start or anywhere at anytime by using attributes.
Example:

[View("MyViewId")]
public class MyView : MonoBehaviour
{
    [Query("MainModal")]
    public VisualElement MainModal;

    [Query<Button>()]
    public List<Button> Buttons;

    [Query(".unity-label")]
    public Label[] Labels;

    [Query<ScrollView>("TimelineScroll")]
    private ScrollView _scrollView;

    public void OnEnable() => View.ExecuteQueries(this);
}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions