I'm trying to customize Array object in Custom Inspector looks like below image.
and I can't find how to do this. :-(
Can you tell me how to do it? any link or answer will very helpful.
Below Code is what I'm working so far.
myClass.cs
using UnityEngine;
using System.Collections;
public class myClass : MonoBehaviour {
public string[] myArray = new string[0];
void Update () {
// do something
}
}
myClassEditor.cs
using UnityEngine;
using UnityEditor;
using System.Collections;
[CustomEditor(typeof(myClass))]
[CanEditMultipleObjects]
public class myClassEditor : Editor {
SerializedObject serializedObj;
myClass myClassScript;
SerializedProperty myArray;
void OnEnable() {
serializedObj = new SerializedObject (target);
myClassScript = (myClass)target;
myArray = serializedObject.FindProperty ("myArray");
}
public override void OnInspectorGUI() {
serializedObj.Update ();
EditorGUILayout.HelpBox ("Default Inspector", MessageType.None);
DrawDefaultInspector();
EditorGUILayout.HelpBox ("Custom Inspector", MessageType.None);
EditorGUILayout.PropertyField(myArray, new GUIContent("My Custom Array"), true);
serializedObj.ApplyModifiedProperties ();
}
}
