Unity previous page Next switch function implementation source (for reference Only)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.