unity
-
[unity - mathf] clamp에 관하여 (요약)unity 2022. 4. 1. 11:59
clamp는 mathf로 사용할 수 있으며 최대/최소값 사이의 float 값이 value 범위 외의 값이 되지 않도록 한다. 사용법 public class ExampleClass : MonoBehaviour { void Update() { transform.position = new Vector3(Mathf.Clamp(transform.position.y, 1.0F, 3.0F); } void Update() { 새로운 포지션 변수 = 백터 3 생성(Mathf.Clamp(y축 값, float형, float형); }
-
Instantiate란unity 2022. 3. 30. 15:04
public static Object Instantiate(Object original, Vector3 position, Quaternion rotation); public static Object Instantiate(오브젝트 원본(prefab), 복사될 오브젝트의 방향, 복사될 오브젝트의 회전 값); 만약 회전 값이 필요치 않는 경우 rotation에 Quaternion.identity을 넣으면 된다. 이 함수는 편집기의 Duplicate 명령과 유사한 방법으로 개체의 복제본을 만듭니다. GameObject 또는 GameObject에 연결된 무언가를 복제하는 경우 선택적으로 위치와 회전을 지정할 수도 있습니다. 컴포넌트를 복제하는 경우 컴포넌트가 연결된 GameObject도 복제됩니다. GameObj..