Advertisement
Guest User

Untitled

a guest
Jan 12th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.04 KB | None | 0 0
  1. using UnityEngine;
  2. using UnityEditor;
  3. using System.Collections;
  4.  
  5. [CustomEditor(typeof(DigitTotal))]
  6. public class DigitTotalEditor : Editor {
  7.  
  8.     private DigitTotal _dTarget;
  9.  
  10.     public override void OnInspectorGUI() {
  11.         _dTarget = (DigitTotal)target;
  12.  
  13.         DrawDefaultInspector();
  14.         DrawCustomInspector();
  15.     }
  16.  
  17.     void DrawCustomInspector() {
  18.         GUIStyle guiStyle = EditorStyles.textArea;
  19.         guiStyle.wordWrap = true;
  20.  
  21.         EditorGUI.BeginChangeCheck();
  22.  
  23.         _dTarget.mazeNumData = EditorGUILayout.TextArea(_dTarget.mazeNumData, guiStyle, new GUILayoutOption[]
  24.         {
  25.             GUILayout.Height(100f),
  26.             GUILayout.Width(250f),
  27.         });
  28.  
  29.         if(EditorGUI.EndChangeCheck()){
  30.             if(_dTarget.mazeNumData.Length >= 338){
  31.                 _dTarget.mazeNumData.Remove((_dTarget.mazeNumData.Length - 1) - 3, 3);
  32.             }
  33.         }
  34.  
  35.         GUILayout.Space(5f);
  36.         GUILayout.Label("Digits : " + _dTarget.mazeNumData.Length, EditorStyles.boldLabel);
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement