If you want to have a custom Slider, which shows an Array of integer Values (5, 7,8,11,321,512)
you need to do something like this:
Editor Script
using UnityEngine;
using UnityEditor;
[CustomEditor(typeof(Value))]
public class ValueEditor : Editor
{
SerializedProperty intRange;
float select = 0;
public override void OnInspectorGUI()
{
intRange = serializedObject.FindProperty("intRange");
select = CustomIntSlider(intRange,select);
}
float CustomIntSlider(SerializedProperty property,float selected){
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField("My Slider",GUILayout.Width(100));
selected = GUILayout.HorizontalSlider(Mathf.Round(selected),0,property.arraySize-1);
EditorGUILayout.IntField(property.GetArrayElementAtIndex((int)selected).intValue,GUILayout.Width(50));
EditorGUILayout.EndHorizontal();
return selected;
}
}
Monobehaviour
using System.Collections.Generic;
using UnityEngine;
[UnityEditor.CanEditMultipleObjects]
public class Value : MonoBehaviour
{
public List<int> intRange = new List<int>(){5,7,8,11,321,512};
}