chenxin
2020-11-07 d35d31d85fd4b827dc37008aef39c019b6a7781d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using UnityEngine;
using UnityEngine.EventSystems;
 
public class ChangeBtnScale : MonoBehaviour, IPointerDownHandler, IPointerUpHandler
{
    RectTransform rect;
    Vector3 startScale;
 
    public void OnPointerDown(PointerEventData eventData)
    {
        rect.localScale = startScale * 0.9f;
    }
 
    public void OnPointerUp(PointerEventData eventData)
    {
        rect.localScale = startScale;
    }
 
    // Start is called before the first frame update
    private void Awake()
    {
        rect = GetComponent<RectTransform>();
        startScale = rect.localScale;
    }
 
 
 
}