Search Unity

UI - Is image fully visible?

Discussion in 'Scripting' started by Simon75012, Jul 14, 2021.

  1. Simon75012

    Simon75012

    Joined:
    Sep 15, 2016
    Posts:
    79
    Hi,
    I'm looking for a way to know if an image (RectTransform) is covered by an other one.

    I want to display the Image in green if it's fully visible, in red if it's covered by an other one.
    Some screenshots are here to explain.

    The sibling index cannot really helps me as if an Image have a low index, it could be fully visible. I also check all CanvasRenderer property but can't find anything useful.

    Is there an easy way to check that or i need to do some math with every RectTransform position?

    Thanks!
     

    Attached Files:

  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,745
    You would need to do the math. The RectTransformUtility may of use to you to simplify computations.