Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Unity UI UI Input stop propagation.

Discussion in 'UGUI & TextMesh Pro' started by Domvel, Oct 29, 2018.

  1. Domvel

    Domvel

    Joined:
    Sep 18, 2018
    Posts:
    24
    Hi there,

    is there a way to block the Input for non-UI elements if the Input was handled on UI?
    I know there is a method of the EventSystem IsPointerOverGameObject()
    but I looking for a more common way. Also this will not help If I have a Text Input.
    When the user enter a text, the scripts in the game also handles the Keyboard Input. This is annoying.
    Is there a similar feature like in HTML / JS "Stop Propagation" / "Prevent Default"?
    I don't want to handle any input of my game if the UI is in use.
    In best way: Don't change any non-ui script. But currently I use IsPointerOverGameObject() for some.
    But how to handle the Text Input? I could check the text input state. But I don't want so much UI logic in my non-ui scripts.

    I would be very grateful for every tip and advice.
     
  2. unity_ysZ7omGPDBHozg

    unity_ysZ7omGPDBHozg

    Joined:
    May 2, 2019
    Posts:
    2
    did you find anything? adding IsPointerOverGameObject() to every gameobject seems wrong.