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

No raycasting while focus is on UI object

Discussion in 'Physics' started by Vedrit, Oct 8, 2016.

  1. Vedrit

    Vedrit

    Joined:
    Feb 8, 2013
    Posts:
    514
    Hi all,
    I've noticed an issue where if, for example, the player were to be interacting with text input, no raycasts are being done, even if the raycasts are being done in completely unrelated scripts at regular intervals on unrelated objects.
    In my project, this typically presents itself as the character flying up infinitely if they happen to activate the chat input when they press the spacebar. It also seems to present itself as being unable to send raycasts to target something if they have a window open (which have buttons to close the window)
    Any ideas why this is a thing and what to do about it would be appreciated.
     
  2. Vedrit

    Vedrit

    Joined:
    Feb 8, 2013
    Posts:
    514
    Anyone?
     
  3. Thorskin

    Thorskin

    Joined:
    Oct 10, 2016
    Posts:
    13
    EventSystem.current.IsPointerOverGameObject() returns true if the mouse is pointing to a UI object.
     
  4. Vedrit

    Vedrit

    Joined:
    Feb 8, 2013
    Posts:
    514
    That's what I've thought, but any UI objects that might in the way are set to CanvasGroup.BlockRaycast false
     
  5. Vedrit

    Vedrit

    Joined:
    Feb 8, 2013
    Posts:
    514
    Also doesn't explain raycasts not working that originate from an object in the world that goes down
     
  6. Vedrit

    Vedrit

    Joined:
    Feb 8, 2013
    Posts:
    514
    Anyone else?