클래스의 속성들(멤버 변수)을 관리하기 편하게 구분해 주는 header가 있습니다.
아래 코드와 같이 구분 하면 인스펙터 창을 그룹화 해줄 수 있습니다.
[System.Serializable]
public class CameraSettings {
[Header("-Positioning-")] public Vector3 m_CamPositionOffsetLeft;
public Vector3 m_CamPositionOffsetRight;
[Header("-Camera Options-")] public Camera m_UICamera; // UI 용 카메라
public float m_MouseXSensitivity = 5.0f; // 마우스 감도
public float m_MouseYSensitivity = 5.0f; // 마우스 감도
public float m_MinAngle = -30.0f;
public float m_MaxAngle = 70.0f;
public float m_RotationSpeed = 5.0f; // 회전 속도
public float m_MaxCheckDistance = 0.1f; //
[Header("-Zoom-")] public float m_FieldOfView = 70.0f; // field of view
public float m_ZoomFieldOfView = 30.0f; // 확대했을 때의 field of view
public float m_ZoomMoreFieldOfView = 12.0f; // 좀 더 확대했을 때의 field of view
public float m_ZoomSpeed = 3.0f; // 확대 속도
[Header("-Visual Options-")] public float m_HideMeshWhenDistance = 0.5f; // 타겟의 메쉬를 숨길 때의 거리
}
실제로 인스펙터를 통해서 스크립트를 보면 빨간 네모 박스와 같이 나눌 수 있습니다.
header 안에 설정한 문자열이 표시됩니다.
참고 문서
https://docs.unity3d.com/ScriptReference/HeaderAttribute.html
Unity - Scripting API: HeaderAttribute
Success! Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable. Close
docs.unity3d.com
'Engine > Unity' 카테고리의 다른 글
유니티 Camera.main은 캐싱해서 쓰자 (0) | 2023.02.11 |
---|---|
유니티 [ExecuteInEditMode]로 플레이 하지 않은 상태에서 값 변경하기 (0) | 2023.02.11 |
Unity Addressable Asset System 좋은 글 링크 (0) | 2023.01.18 |
Unity 2021 에서 auto-refresh 기능 끄기 (0) | 2023.01.17 |
유니티 2022.2 로딩화면 믓지네! (0) | 2022.12.10 |