728x90
데이터 유형
변수의 작동 방식을 정확히 이해할 수 있도록 값과 레퍼런스 데이터 유형의 주요 차이점에 대해 알아볼까요?
Value
- int
- float
- double
- bool
- char
- Structs
- Vector3
- Quaternion
Reference
- Classes
- Transform
- GameObject
DatatypeScript
using UnityEngine;
using System.Collections;
public class DatatypeScript : MonoBehaviour
{
void Start ()
{
//값 유형 변수
Vector3 pos = transform.position;
pos = new Vector3(0, 2, 0);
//레퍼런스 유형 변수
Transform tran = transform;
tran.position = new Vector3(0, 2, 0);
}
}
참고 : 유니티 튜토리얼
728x90
'게임엔진 > Unity' 카테고리의 다른 글
Unity - 인스턴스화 (0) | 2024.07.02 |
---|---|
Unity - Class (0) | 2024.07.02 |
Unity - GetComponent (0) | 2024.07.02 |
Unity - OnMouseDown (0) | 2024.07.02 |
Unity - GetAxis (0) | 2024.07.02 |