Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Any reason for additionally checking if Image.sprite is default when null-checking?

Discussion in 'UGUI & TextMesh Pro' started by Addeman, Aug 25, 2022.

  1. Addeman

    Addeman

    Joined:
    Oct 20, 2020
    Posts:
    5
    I was just writing a null check for an Image-component's sprite, and was thinking maybe it's also good to check if the Sprite-variable is default, meaning "Unassigned" if I remember correctly. I would simply just like to know if there any reason to even check for default in this case? If the sprite is unassigned, the null-check would still pick up on it?