Doing a simple PostProcessor to use a curve to modify a value. As the new Input System still can’t display AnimationCurves without an error I did a simple Custom UI for it, but the OnGUI method is never called. Have I missed somethiong obvious?
Processor Class: CurveProcessor.cs
using UnityEngine;
using UnityEngine.InputSystem;
#if UNITY_EDITOR
using UnityEditor;
[InitializeOnLoad]
#endif
public class CurveProcessor : InputProcessor<float>
{
[SerializeField]
AnimationCurve curve = new AnimationCurve(new Keyframe(0, 0), new Keyframe(1, 1));
public float test;
#if UNITY_EDITOR
static CurveProcessor()
{
Initialize();
}
#endif
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
static void Initialize()
{
InputSystem.RegisterProcessor<CurveProcessor>();
}
public override float Process(float value, InputControl control)
{
return curve.Evaluate(value);
}
public AnimationCurve GetCurve()
{
return curve;
}
}
Editor Class: CurveProcessorEditor.cs
using UnityEngine;
using UnityEngine.InputSystem.Editor;
using UnityEditor;
public class CurveProcessorEditor : InputParameterEditor<CurveProcessor>
{
public override void OnGUI()
{
Debug.Log("OnGUI");
AnimationCurve curve = target.GetCurve();
curve = EditorGUILayout.CurveField("Curve", curve);
target.test = EditorGUILayout.Slider("Test", target.test, 0.0f, 1.0f);
}
}
The code is doing something as it stops the default UI being displayed, but the Debug.Log message never appears in the console and there are no fields.