using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class UI_Control : MonoBehaviour {
// Use this for initialization
void Start () {
}
public Sprite[] SpriteTexture = new Sprite[3];
SpriteRenderer Sprite_Renderer;
// Update is called once per frame
void Update () {
}
/// <summary>
/// OnMouseDown is called when the user has pressed the mouse button while
/// over the GUIElement or Collider.
/// </summary>
void OnMouseDown () {
if (gameObject.name == "StartGame") {
Sprite_Renderer = gameObject.GetComponent<SpriteRenderer> ();
Sprite_Renderer.sprite = SpriteTexture[2];
} else if (gameObject.name == "ExitGame") {
Sprite_Renderer = gameObject.GetComponent<SpriteRenderer> ();
Sprite_Renderer.sprite = SpriteTexture[2];
}
}
/// <summary>
/// Called when the mouse enters the GUIElement or Collider.
/// </summary>
unity3d 按钮变色
最新推荐文章于 2022-12-08 11:42:09 发布