Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
ai.fluctio.fluctio-sim / Core / Components / MachineLearning / Agents / DecisionRequesterEditor.cs
Size: Mime:
#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