ercbrk
0
Q:

unity c# change image source

// Change From GameOject
public GameObject GameObjectWithImage;
public Sprite ImageYouWant;
GameObjectWithImage.GetComponent<Image>().sprite = ImageYouWant

// Change From Image
public Image Image;
public Sprite ImageYouWant;
Image.sprite = ImageYouWant
3
public Image test;
public Sprite example;

void Start()
{
 test.sprite = example; //change the source image of the image "test" to the sprite "example" 
}
3
         Image[] images = PlayerBarExample.GetComponentsInChildren<Image>();         Image face = images[0];         foreach (Image image in images)         {             if (image.gameObject.CompareTag("face"))                 face = image;         }
1

New to Communities?

Join the community