I have this code
using UnityEngine;
using UnityEditor;
[CustomEditor( typeof(Preview) )]
public class PreviewEditor : Editor
{
float PreviewAngleAlpha = 0.25f;
public override void OnInspectorGUI() {
PreviewAngleAlpha = EditorGUILayout.Slider("PreviewAngle Alpha: ", PreviewAngleAlpha, 0.0f, 1.0f, GUILayout.Width(350));
}
}
so I have a value PreviewAngleAlpha that varies between 0 and 1 that I can adjust with a slider in the inspector, but everytime when I click on an a different object and then click back on the first object with this custom inspector on it, the value resets to 0.25f… How can I make it so that the inspector keeps using the same values?