I have made a simple script, where I am changing image sprites by button click. I want to give an explanation for these images, so I am wanting to add text components for each sprite.
How to do that?
Here is what I made:
public class TutorialMenu : MonoBehaviour
{
public List<Sprite> spriteCollection = new List<Sprite>();
public Image original;
public GameObject okButton;
public GameObject startButton;
private int m_spriteIndex = 0;
private int m_spriteCount = 0;
private void Start()
{
m_spriteCount = spriteCollection.Count;
original.sprite = spriteCollection[m_spriteIndex];
}
public void NewImage()
{
m_spriteIndex++;
if (m_spriteIndex == m_spriteCount)
{
m_spriteIndex = m_spriteCount -1;
okButton.SetActive(false);
startButton.SetActive(true);
}
original.sprite = spriteCollection[m_spriteIndex];
}
}