본문 바로가기
Unity 공부

[Unity] URP Inspector에서 HDR 컬러 피커 (Color Picker) 사용하고 싶을 때

by 개발하는 디토 2023. 2. 15.

일반적인 Color Picker

Unity C# Script에서 Color 변수를 Inspector에서 보면 아래와 같이 RGBA만 설정할 수 있는 Color Picker 창이 나온다.

Intensity 없음

 

HDR Color Picker

HDR 옵션을 함께 주고 싶다면 아래와 같이 작성하면 된다.

[ColorUsageAttribute(true,true)]
[SerializeField] private Color[] _colorsHDR; // Colors will be set in Inspector

 

그러면 놀랍게도 HDR Color Picker를 사용할 수 있다!

Intensity 설정 가능
나의 아름다운 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

 

댓글