1

How do I change the next image with buttons while images are loading dynamically in Unity3D using C#.

 public void NextPictureInGallery()
    { 
        int i=0;//index of image
        if(i + 1 < image.Length)
        {
            i++;
        }
     }

enter image description here

Images are in a Scroll view

Ciprian Jijie
  • 479
  • 5
  • 20

2 Answers2

1

You can change the normalized position of your ScrollRect.

Stud
  • 521
  • 4
  • 8
1
public Sprite[] myImage; // Its length descried in Inspector and assign sprite images
public Button myBtn;
int i=0;
void Update()
{
  if(Input.GetMouseButtonDown(0)) // HeresI'm checking condition for Mouse Input,  Change this based on your 
  {    
    if(i+1 < myImage.Length)
    {
     //Make sure it is added in the Inspector.
     myBtn.image.sprite = myImage[i];
     i++;
    }
  }
}

Reference

Check and let me know

Community
  • 1
  • 1
Rasa Mohamed
  • 882
  • 1
  • 6
  • 14