River Jiang
2020-10-27 1f5eda1c9d22a3676298751c7282a5874f13bed0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
 
namespace MoreMountains.NiceVibrations
{
    public class BallDemoWall : MonoBehaviour
    {
        protected RectTransform _rectTransform;
        protected BoxCollider2D _boxCollider2D;
 
        protected virtual void OnEnable()
        {
            _rectTransform = this.gameObject.GetComponent<RectTransform>();
            _boxCollider2D = this.gameObject.GetComponent<BoxCollider2D>();
 
            _boxCollider2D.size = new Vector2(_rectTransform.rect.size.x , _rectTransform.rect.size.y );
        }        
    }
}