Repository URL to install this package:
Version:
1.3.1 ▾
|
#if UNITY_EDITOR
using System;
using Unity.MLAgents;
using UnityEditor;
using UnityEngine;
namespace Fluctio.FluctioSim.Core.Components.MachineLearning.Agents
{
[CustomEditor(typeof(DecisionRequester), true)]
public class DecisionRequesterEditor : Editor
{
private int DrawIntField(string fieldName, int min, int max)
{
var property = serializedObject.FindProperty(fieldName);
var label = new GUIContent(property.displayName, property.tooltip);
var value = EditorGUILayout.IntField(label, property.intValue);
value = Math.Clamp(value, min, max);
property.intValue = value;
return value;
}
public override void OnInspectorGUI()
{
serializedObject.Update();
var decisionPeriod = DrawIntField("DecisionPeriod", 1, int.MaxValue);
_ = DrawIntField("DecisionStep", 0, decisionPeriod - 1);
DrawPropertiesExcluding(serializedObject, "m_Script", "DecisionPeriod", "DecisionStep");
serializedObject.ApplyModifiedProperties();
}
}
}
#endif