Hello, Im new in C#, I want to change the orange circle background of the icon in UI belonging to the game object, when Im collected it. Could you help me, what is the easiest way to do that? I can collect them and clicking them with interfaces. But I cant figure it out how to change the icons. It’s necessary to do it with scriptableobjects? Thank you.
First of all, scriptable objects are always optional and can just help you to create things easier. If you want to change an image of something you need to access that gameobject and get the image component. Then you can change it to
public Sprite newSprite;
public void ChangeImage()
{
iconGameObject.GetComponent<Image>().sprite = newSprite;
}
Thank you!