- Home /
converting Textures to Images ?
Hi there
I have a list of type Texture filled with 13 png-files. But if I want to assign on of there png-files to my image field on my UI, it does not accept textures in the image slot. Do I need to convert my textures to images ?
I've tried to make a list of type Images to solve this Problem, but that type does not accept my nog-files.
any ideas ? i'll paste my code down below :
public Image vakje_img;
public List<Texture> images;
private void Update()
{
if (Input.GetMouseButtonDown(0)) {
vakje_img = images[0];
}
}
Answer by Hellium · Feb 28, 2019 at 10:48 PM
If the images are meant to be used on your UI, you need Sprites
instead of Textures
.
Assigning the sprite of an Image
component must be done like this:
vakje_img.sprite = images[0];
You have to comment Hellium and put @Hellium to notify him about your thanks. You don't post another answer(as it isn't an answer).
Your answer
Follow this Question
Related Questions
compress photos on import 0 Answers
How To Apply A Texture Atlas For UI Image Objects? 0 Answers
Get Image from another scene 2 Answers
A node in a childnode? 1 Answer
How to find the bottom position of a Image based on it's height? 2 Answers