Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Is there a way to prevent the back VE receive events when the front VE receive events?

Discussion in 'UI Toolkit' started by YinZuoyu, Aug 31, 2020.

  1. YinZuoyu

    YinZuoyu

    Joined:
    Aug 25, 2015
    Posts:
    44
    Is there a way to prevent the behind VisualElement receive events when the front VisualElement receive events?
    In my test,the parent VisualElement and the behind VisualElement always receive events but I just want the child or front VisualElement receive events;
     
  2. jonathanma_unity

    jonathanma_unity

    Unity Technologies

    Joined:
    Jan 7, 2019
    Posts:
    229
  3. Haxel0rd

    Haxel0rd

    Joined:
    May 20, 2021
    Posts:
    49
    Adding example of how to implement in code:
    Code (CSharp):
    1. void ButtonPress(PointerDownEvent evt){
    2.     evt.StopPropagation();
    3.     // do stuff here ...
    4. }