HKI Core
TextLocalizationElementDrawer.cs
Go to the documentation of this file.
1 using UnityEngine;
2 using UnityEditor;
3 
4 namespace HKI.Core.Loc.Editor
5 {
9  [CustomPropertyDrawer(typeof(TextLocalization.TextLocalizationElement))]
10  public class TextLocalizationElementDrawer : PropertyDrawer
11  {
12  // OnGUI function
13  public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
14  {
15  float languageRectWidth = 80.0f;
16  float space = 2.0f;
17 
18  Rect languageRect = new Rect(position.x, position.y, languageRectWidth, position.height);
19  Rect localizationTextRect = new Rect(position.x + languageRectWidth + space, position.y, position.width - languageRectWidth - space, position.height);
20 
21  EditorGUI.PropertyField(languageRect, property.FindPropertyRelative("Language"), GUIContent.none);
22  EditorGUI.PropertyField(localizationTextRect, property.FindPropertyRelative("Text"), GUIContent.none);
23  }
24  }
25 }
override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
Custom property drawer for the TextLocalizationElement class.