일반적인 Color Picker
Unity C# Script에서 Color 변수를 Inspector에서 보면 아래와 같이 RGBA만 설정할 수 있는 Color Picker 창이 나온다.
HDR Color Picker
HDR 옵션을 함께 주고 싶다면 아래와 같이 작성하면 된다.
[ColorUsageAttribute(true,true)]
[SerializeField] private Color[] _colorsHDR; // Colors will be set in Inspector
그러면 놀랍게도 HDR Color Picker를 사용할 수 있다!
참고로 이런 Color Picker는 항상 색상을 고를 때 Alpha 값이 0으로 설정되어 있으니 알파값을 원하는 값으로 초기화해주는 것을 잊지 말자.
번외
포럼에서 누가 [ColorUsage(true, true)]만으로도 사용할 수 있다길래 IDE를 봤더니 진짜 그렇다.
찾아본 자료
Unity Forum
HDR color picker on inspector
In order to convert the color picker to HDR on a shader inspector, simply put [HDR] in front of the property. But this doesn't work with a C# script....
forum.unity.com
Unity Scripting API: ColorUsageAttribute
Unity - Scripting API: ColorUsageAttribute
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
'Unity 공부' 카테고리의 다른 글
[Unity] Google Play Store와 Unity In-App Purchase 연결 (구글 개발자 콘솔 라이선스 찾기) (0) | 2023.02.19 |
---|---|
[Unity] In-App Purchase 테스트 (1) | 2023.02.19 |
[Unity] 2D Shader Graph - 이미지 외곽선 Outline 만들기 (0) | 2023.02.12 |
[Unity] Json으로 게임 Player, Stage, Level 데이터 관리 (0) | 2023.01.29 |
모바일 게임 성능 최적화 (0) | 2023.01.23 |
댓글