Search Unity

RectangleContainsScreenPoint and World Space Canvas

Discussion in 'Scripting' started by Nit_Ram, Dec 23, 2018.

  1. Nit_Ram

    Nit_Ram

    Joined:
    May 8, 2016
    Posts:
    7
    Hi there!

    I am writing a script that checks in onEndDrag, if the dragged object was dropped on an inventory slot (Image).
    To check it, I use the RectTransformUtility.RectangleContainsScreenPoint method. This works perfectly fine, as long as the item slot is on a Screen Space Canvas.
    Unfortunatly I need the slot to be on a World Space Canvas. But this seems to break the RectangleContainsScreenPoint.
    Is there a way to make this work with Images on a World Space Canvas?

    Greetings, and Merry Christmas! :)
     
  2. Nit_Ram

    Nit_Ram

    Joined:
    May 8, 2016
    Posts:
    7
    eses likes this.