Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question Check if UI Element in screen space canvas is visible or not

Discussion in 'UGUI & TextMesh Pro' started by OctoSharko, Mar 28, 2024.

  1. OctoSharko

    OctoSharko

    Joined:
    Dec 9, 2016
    Posts:
    42
    Hi,

    I'd like to know if a GameObject that is a UI Element (Button for example) in a screen space canvas is visible on screen or not.

    Checking activeself is not good enough because if the element is active but has an inactive parent, it won't be visible.

    I've been googling away for an hour without success. Should I check if all its parents are active ? That can be costly...

    Can you kindly help ?

    Thanks
     
  2. ualogic

    ualogic

    Joined:
    Oct 15, 2018
    Posts:
    25
    OctoSharko likes this.
  3. OctoSharko

    OctoSharko

    Joined:
    Dec 9, 2016
    Posts:
    42