wangguan
2020-11-30 e45603a605b359a790f91822d76a5e5e49b3d5c6
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;
    }
 
 
 
}