public image icon;

icon.sprite = ORK.Abilities.Get(4).GetIcon();

I want to use the code above, but I cannot assign it because the return type of GetIcon is a Texture.

i.e
I want to assign sprite to the UGUI's Image component, but I don't know how to assign the icon image set in the editor through scripting.
  • edited June 2020
    You can't convert a texture into a sprite - but you can display the texture using a RawImage component instead of an Image component.
    Post edited by gamingislove on
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.