您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
45 行
1.4 KiB
45 行
1.4 KiB
using UnityEditor;
|
|
using Unity.MLAgents.Integrations.Match3;
|
|
namespace Unity.MLAgents.Editor
|
|
{
|
|
[CustomEditor(typeof(Match3SensorComponent), editorForChildClasses: true)]
|
|
[CanEditMultipleObjects]
|
|
internal class Match3SensorComponentEditor : UnityEditor.Editor
|
|
{
|
|
public override void OnInspectorGUI()
|
|
{
|
|
var so = serializedObject;
|
|
so.Update();
|
|
|
|
var component = (Match3SensorComponent)target;
|
|
var board = component.GetComponent<AbstractBoard>();
|
|
if (board == null)
|
|
{
|
|
EditorGUILayout.HelpBox("You must provide an implementation of an AbstractBoard.", MessageType.Warning);
|
|
return;
|
|
}
|
|
|
|
// Drawing the RenderTextureComponent
|
|
EditorGUI.BeginChangeCheck();
|
|
|
|
EditorGUI.BeginDisabledGroup(!EditorUtilities.CanUpdateModelProperties());
|
|
{
|
|
EditorGUILayout.PropertyField(so.FindProperty("m_SensorName"), true);
|
|
EditorGUILayout.PropertyField(so.FindProperty("m_ObservationType"), true);
|
|
}
|
|
EditorGUI.EndDisabledGroup();
|
|
|
|
var requireSensorUpdate = EditorGUI.EndChangeCheck();
|
|
so.ApplyModifiedProperties();
|
|
|
|
if (requireSensorUpdate)
|
|
{
|
|
UpdateSensor();
|
|
}
|
|
}
|
|
|
|
void UpdateSensor()
|
|
{
|
|
}
|
|
}
|
|
}
|