In the project we sometimes need to implement a switch to the next page of the picture, switch on the next song, and so on similar functions. Here wrote a simple implementation of the source code (for reference only), If there is a better way to welcome the proposed, common Progress ~
To switch the previous page to the next picture as an example:
usingunityengine;usingsystem.collections;usingunityengine.ui;
public classPanoramamanager:monobehaviour {//Image Storage Arraytexture2d[]arr; //Next button Count index inti =1; //Previous button Count index intJ =-1; //switch to the next one publicIEnumerator setnexttexture () {if(here's How you can determine the criteria for interacting with the next page of the ui) {if(i < Arr.) Length-1) { //the things you want to do. .. J= i-1; I++; } Else { //give the wrong hint That's already the last one ... } } } //Toggle the previous one publicIEnumerator setbeforetexture () {if(here's How you determine the criteria for interacting with the previous page Ui) {if(j >=0) { //the things you want to do. .. I= j +1; J--; } Else { //give the wrong hint That's already the first one ... } } }}
Unity previous page Next switch function implementation source (for reference Only)