Search Unity

How to register event handler to controls of UXML? (UIElements)

Discussion in 'UI Toolkit' started by Kichang-Kim, Apr 17, 2019.

  1. Kichang-Kim

    Kichang-Kim

    Joined:
    Oct 19, 2010
    Posts:
    1,011
    Hi, I have a question about how to register event handler to controls of UXML.

    Especially, OnClick() for Button and OnValueChanged for almost field controls. I know that there is SerializedObject binding mechanism, but I want to hook for custom logic from C# script.

    Wihtout UXML, I can create button by new Button(myHandler); but I dont know that how to access controls in UXML from script and register my handler to each controls.

    Thanks.
     
  2. jonathanma_unity

    jonathanma_unity

    Unity Technologies

    Joined:
    Jan 7, 2019
    Posts:
    229
    V5Studio and Kichang-Kim like this.