× {{alert.msg}} Never ask again
Get notified about new tutorials RECEIVE NEW TUTORIALS

Loop Through Array of Images

Hristo Hristov
Mar 15, 2015
<p>Here's how you can do this, I have recently implemented this in my game :</p> <pre><code>public class ImageHandler : MonoBehaviour { public Image img; public List&lt;Sprite&gt; imageObjs; private Sprite activeImage; public void LoadLevelImage(int levelNumber) { this.activeImage = (Sprite)Instantiate(imageObjs[levelNumber - 1]); img.sprite = activeImage; } } </code></pre> <p>This tip was originally posted on <a href="http://stackoverflow.com/questions/28929461/Loop%20Through%20Array%20of%20Images/28929653">Stack Overflow</a>.</p>
comments powered by Disqus