https://dreamaz.tistory.com/1118
์ ๋ํฐ์์ ๊ฒ์ ์ค๋ธ์ ํธ ํญ, ๋์ด ๊ตฌํ๋ ๋ฐฉ๋ฒ(How to get width, height of GameObject in Unity)
์๋ ํ์ธ์. ๋๋ฆฌ๋จธ์ฆ์ ๋๋ค. ์ค๋๋ง์ ํ๋ก๊ทธ๋๋ฐ ๊ด๋ จ ํฌ์คํ ์ ์ฐ๋ค์. ์๋ฃ ๋ณด๊ด์ ์ํด ๊ธฐ๋ก ๋จ๊น๋๋ค. ์ ๋ํฐ์์ GameObject์ Width์ Height๋ฅผ ๊ตฌํ๋ ค๊ณ ๊ตฌ๊ธ, ๋ค์ด๋ฒ๋ฅผ ๋ค์ ธ๋ดค์ง๋ง.. ์๋ฌด๋ฆฌ
dreamaz.tistory.com
์ด ์์ฒด๊ฐ ๋ณ์๊ฐ์ธ๋ฏ ํ๋ค. ๋์ ํด๋น ์คํฌ๋ฆฝํธ ํ์ผ์ด ์ง์ ๋ ๊ฒ์ ์ค๋ธ์ ํธ์ ๋ํ Rect๊ฐ์ ๊ฐ์ ธ์จ๋ค.
GetComponent.<RectTransform>().rect.width
GetComponent.<RectTransform>().rect.height
๊ณต์ ๋ฌธ์ ์์
HingeJoint hinge = gameObject.GetComponent( typeof(HingeJoint) ) as HingeJoint;
Start()ํจ์์์ ๋๋ Awake()ํจ์์์ ๋ฏธ๋ฆฌ ํ ๋นํด๋์์ผ ํจ.
Script๋ช ์ด ํ์ ๋ช ์ด ๋ ์๋ ์๋ค. ๋์ ๊ฐ์ ์ปดํฌ๋ํธ์ ์ง์ ๋์ด ์์ด์ผ ํ๋ ๊ฒ ๊ฐ๋ค.
https://m.blog.naver.com/PostView.naver?isHttpsRedirect=true&blogId=wjsdldks&logNo=220379134983
[Unity] GetComponent ๊ด๋ จ ํจ์
GetComponent ๊ด๋ จ ํจ์ this.gameObject.GetComponent<์ปดํฌ๋ํธํ์ >() ์์ ์ ๊ฒ์์ค๋ธ์ ํธ์...
blog.naver.com