NaughtyAttributes
โดย Denis Rizov
เพิ่มปุ่ม ช่องข้อมูลแบบมีเงื่อนไข และการตรวจค่าใน Unity Inspector ด้วย attributes ช่วยทำเครื่องมือปรับค่าคอมโพเนนต์โดยไม่ต้องเขียน custom editor ทุกครั้ง
เริ่มต้น: คู่มือระบุ Unity 2022.3 ขึ้นไป และแพ็กเกจ com.dbrizov.naughtyattributes บน OpenUPM นำเข้า namespace NaughtyAttributes ในสคริปต์ที่จะใช้
ลองใช้: เลือก attribute ให้ตรงกับ field หรือ method เช่น Button สำหรับปุ่ม และ ShowIf/HideIf สำหรับการแสดงช่องแบบมีเงื่อนไข แล้วตรวจ Inspector ของคอมโพเนนต์
ข้อจำกัด: custom editor ทั่วไปไม่รองรับทุก attribute หากต้องการครบให้สืบทอด NaughtyInspector และใช้ NaughtyEditorGUI.PropertyField_Layout แทน EditorGUILayout.PropertyField ตามคู่มือ
แหล่งอ้างอิง: https://dbrizov.github.io/na-docs/ · https://dbrizov.github.io/na-docs/general/installation.html