728x90 반응형 Unity/기초6 [Unity 기초] transform과 Transform Transform은 인스팩터창 안에 저 위에 사진 같은 것을 보았을텐데 그게 Transform이다. 게임오브젝트가 가지는 기본 컴포넌트 중 하나로 Positon,Rotation,Scale의 속성을 가진다. 객체가 아닌 클래스의 개념이다. transform은 해당 게임오브젝트에 할당된 Transform 컴포넌트이다. GetComponent()과 같다. 이런식으로 transform.postion.x 등의 코드를 보았을텐데 이것의 의미는 게임 오브젝트의 Transform 컴포넌트 중 Postion에서 x축을 의미한다. 2021. 9. 27. [Unity] 캐릭터를 WASD키로 이동시키기 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 29 30 31 32 33 34 public class PlayerController : MonoBehaviour { void Start() { } void Update() { // w ->앞 if (Input.GetKey(KeyCode.W)) { transform.position += new Vector3(0.0f, 0.0f, 1.0f); } // s->뒤 if (Input.GetKey(KeyCode.S)) { transform.position -= new Vector3(0.0f, 0.0f, 1.0f); } if (Input.GetKey(KeyCode.A)) { tran.. 2021. 8. 18. [Unity] Singleton 패턴 보호되어 있는 글 입니다. 2021. 8. 16. [Unity] Component 패턴/매니저 만들기 보호되어 있는 글 입니다. 2021. 8. 16. 이전 1 2 다음 728x90 반응형