本章节设计到布局技巧,对于不熟悉布局的,需要自己多加练习,好了直接看效果
上代码
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class MenuBtn : MonoBehaviour {
public List<GameObject> pages = new List<GameObject> ();
public int currentPageIndex = 0;
public GameObject currentPage;
public CanvasGroup cg;
public bool fadingOut = false;
public bool fadingIn = false;
public float fadeRate = 8f;
public float growRate = 0.5f;
public Texture butTexture;
void Update(){
if (fadingOut)
cg.alpha -= fadeRate * Time.deltaTime;
if (fadingIn) {
cg.alpha += fadeRate * Time.deltaTime;
currentPage.transform.localScale +