| | 1 | | using UnityEngine; |
| | 2 | | using UnityEngine.EventSystems; |
| | 3 | |
|
| | 4 | | public class SizeOnHover : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler |
| | 5 | | { |
| | 6 | | public RectTransform targetRectTransform; |
| | 7 | |
|
| | 8 | | public float hoverScale; |
| | 9 | |
|
| | 10 | | public float normalScale; |
| | 11 | |
|
| | 12 | | public void OnPointerEnter(PointerEventData eventData) |
| | 13 | | { |
| 0 | 14 | | if (targetRectTransform != null) |
| 0 | 15 | | targetRectTransform.localScale = Vector3.one * hoverScale; |
| 0 | 16 | | } |
| | 17 | |
|
| | 18 | | public void OnPointerExit(PointerEventData eventData) |
| | 19 | | { |
| 0 | 20 | | if (targetRectTransform != null) |
| 0 | 21 | | targetRectTransform.localScale = Vector3.one * normalScale; |
| 0 | 22 | | } |
| | 23 | | } |