32 lines
809 B
C#
32 lines
809 B
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
using UnityEngine.UI;
|
|
|
|
public class NewBehaviourScript : MonoBehaviour,IPointerEnterHandler,IPointerExitHandler
|
|
{
|
|
[SerializeField] private Sprite defaultSprite;
|
|
[SerializeField] private Sprite clickSprite;
|
|
[SerializeField] private GameObject clickGameSprite;
|
|
|
|
private Image _image;
|
|
private void Start()
|
|
{
|
|
_image = this.GetComponent<Image>();
|
|
}
|
|
|
|
public void OnPointerEnter(PointerEventData eventData)
|
|
{
|
|
_image.sprite = clickSprite;
|
|
clickGameSprite.SetActive(true);
|
|
}
|
|
|
|
public void OnPointerExit(PointerEventData eventData)
|
|
{
|
|
_image.sprite = defaultSprite;
|
|
clickGameSprite.SetActive(false);
|
|
}
|
|
}
|