1、实现UI的变色
设置Highlighted Color为鼠标经过时变的颜色(Normal为常态,Pressed为按下时的颜色,Disabled为禁止的颜色)
2、通过代码实现物体的颜色改变
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Cube_change : MonoBehaviour
{
private Color CubeColor;private Texture CubeTexture;
public GameObject objCube;
// Use this for initialization
void Start ()
{
objCube = GameObject.Find("Cube");objCube.GetComponent<Renderer>().material.color = Color.blue;
}
public void OnMouseEnter()
{
obj