chenxin
2020-11-07 2d6bc7e2a7290be1ed2c8f7b426b76b35e3e824a
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;
    }
 
 
 
}