I would like to set the icon Sprite to My Custom UI Image Component's sprite.
I have set Sprite as icon in ORK Editor.

However, when I use
is of type Texture not Sprite.

Is there a function to load it as a Sprite?

I've seen this done in the past in the forums and it worked fine.
However, I feel that it is inefficient to create a Sprite every time I set up a Sprite in the Editor.
Is there a simpler way to get a Sprite?
int myItemID = int.Parse(gameObject.name);
var myWeapon = ORK.Weapons.Get(myItemID);
Texture tex = myWeapon.GetIcon();
iconImageObj.GetComponent<Image>().sprite = Sprite.Create(tex as Texture2D, new Rect(0, 0, tex.width, tex.height), new Vector2(.5f, .5f));
Sign In or Register to comment.