| #if UNITY_EDITOR |
| using UnityEditor; |
| using UnityEngine; |
| using OnDeviceAgent.AgentCore; |
| namespace OnDeviceAgent.AgentCore.Editor |
| { |
|
|
| [CustomPropertyDrawer(typeof(PasswordFieldAttribute))] |
| public sealed class PasswordFieldDrawer : PropertyDrawer |
| { |
| public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) |
| { |
| if (property.propertyType != SerializedPropertyType.String) |
| { |
| EditorGUI.PropertyField(position, property, label); |
| return; |
| } |
|
|
| EditorGUI.BeginProperty(position, label, property); |
| EditorGUI.BeginChangeCheck(); |
| var value = EditorGUI.PasswordField(position, label, property.stringValue); |
| if (EditorGUI.EndChangeCheck()) |
| property.stringValue = value; |
| EditorGUI.EndProperty(); |
| } |
| } |
| } |
| #endif |
|
|