Question by
AmazingDeveloper2 · Apr 08, 2016 at 08:08 AM ·
c#unity 5canvas
How to select images, which I want to display?
In my dialog menu I have Image component, for which I made 3-frames animation. For each person I want to display different 3 images. Now it show only 3 images for one person.
What is the best way to display those 3 images, which I want? Should I make one array for all images and say, which of them should be displayed?
public Texture[] frames; // array of textures
public float framesPerSecond = 2.0f; // delay between frames
RawImage image = null;
void Start()
{
image = gameObject.GetComponent<RawImage>();
}
void Update()
{
int index = (int)(Time.time * framesPerSecond) % frames.Length;
image.texture = frames[index];
}
1.jpg
(70.8 kB)
Comment
Your answer
Follow this Question
Related Questions
Canvas still shows 1 Answer
Can't get GUI canvas to show on camera 1 Answer
Unity Photon Pun 1 Answer
Multiple Canvases visual overlap issue 2 Answers
Trouble with closing Unity 5 ads 0 Answers