浏览代码

clean up ChangeChecks, rename method

/bug-failed-api-check
Chris Elion 5 年前
当前提交
2475677a
共有 1 个文件被更改,包括 21 次插入15 次删除
  1. 36
      com.unity.ml-agents/Editor/BehaviorParametersEditor.cs

36
com.unity.ml-agents/Editor/BehaviorParametersEditor.cs


{
var so = serializedObject;
so.Update();
bool needModelUpdate; // Whether the name, model, or inference device changed.
bool behaviorTypeChanged;
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(so.FindProperty("m_BehaviorName"));
bool needModelUpdate = EditorGUI.EndChangeCheck();
EditorGUI.BeginChangeCheck(); // global
{
EditorGUILayout.PropertyField(so.FindProperty("m_BehaviorName"));
}
needModelUpdate = EditorGUI.EndChangeCheck();
var brainParamsChanged = EditorGUI.EndChangeCheck();
EditorGUILayout.PropertyField(so.FindProperty("m_Model"), true);
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(so.FindProperty("m_InferenceDevice"), true);
EditorGUI.indentLevel--;
{
EditorGUILayout.PropertyField(so.FindProperty("m_Model"), true);
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(so.FindProperty("m_InferenceDevice"), true);
EditorGUI.indentLevel--;
}
EditorGUILayout.PropertyField(so.FindProperty("m_BehaviorType"));
var behaviorTypeChanged = EditorGUI.EndChangeCheck();
{
EditorGUILayout.PropertyField(so.FindProperty("m_BehaviorType"));
}
behaviorTypeChanged = EditorGUI.EndChangeCheck();
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(so.FindProperty("TeamId"));
EditorGUI.BeginDisabledGroup(Application.isPlaying);
{

var othersChanged = EditorGUI.EndChangeCheck();
m_RequireReload = needModelUpdate || brainParamsChanged || behaviorTypeChanged || othersChanged;
m_RequireReload = EditorGUI.EndChangeCheck();
UpdateAgent(needModelUpdate, behaviorTypeChanged);
UpdateAgentFromBehaviorParameters(needModelUpdate, behaviorTypeChanged);
}
}

}
}
void UpdateAgent(bool needModelUpdate, bool behaviorTypeChanged)
void UpdateAgentFromBehaviorParameters(bool needModelUpdate, bool behaviorTypeChanged)
{
if (Application.isPlaying)
{

正在加载...
取消
保存