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

Alpha transparency vs SetActive ? What is more efficient?

Discussion in 'Editor & General Support' started by zapposh, Jan 28, 2019.

  1. zapposh

    zapposh

    Joined:
    Nov 12, 2016
    Posts:
    117
    I have fake 2D shadow sprites below moving characters, that are displayed, or not, depending on distance to ground via raycast hitpoint checks which run in the LateUpdate loop.

    What is more efficient:
    - updating the shadow alpha (0/1)
    - enabling/disabling the shadow SpriteRenderer component
    - updating whether the shadow GameObject is active or not -> SetActive(true(false)

    Thanks
     
  2. iMobCoding

    iMobCoding

    Joined:
    Feb 13, 2017
    Posts:
    164
    Efficiency goes from bottom to top of your list
     
    zapposh likes this.