Isn’t it possible to check if a sprite variable is null? The following code specifically checks whether a sprite variable (set in the inspector) is null or not, but if it’s null it still passes through the check and then causes a null reference error on the line that stores the sprite reference into a UI image element.
Sprite IconSprite = OMDScript.Icon;
if (IconSprite != null) CarriedInventoryUIImageArray*.sprite = IconSprite;*
I can’t see any logic error in the code, so why isn’t it detecting that a sprite is null ?