UISwitchImageTutor.cs 364 B

1234567891011121314151617181920212223
  1. using System.Collections.Generic;
  2. using UnityEngine;
  3. using System.Collections;
  4. public class UISwitchImageTutor : MonoBehaviour
  5. {
  6. public List<Texture> Textures;
  7. public UITexture Texture;
  8. private int index = 0;
  9. void OnClick()
  10. {
  11. Texture.mainTexture = Textures[index];
  12. if (index == Textures.Count-1)
  13. {
  14. index = 0;
  15. }
  16. else
  17. {
  18. index++;
  19. }
  20. }
  21. }