浏览代码

Fix brain type not saved in inspector

/develop-generalizationTraining-TrainerController
Maxime Plantady 7 年前
当前提交
0a0fbbeb
共有 1 个文件被更改,包括 9 次插入7 次删除
  1. 16
      unity-environment/Assets/ML-Agents/Editor/BrainEditor.cs

16
unity-environment/Assets/ML-Agents/Editor/BrainEditor.cs


EditorGUILayout.HelpBox ("A Brain GameObject myst be a child of an Academy GameObject!", MessageType.Error);
} else if (myBrain.transform.parent.GetComponent<Academy> () == null) {
EditorGUILayout.HelpBox ("The Parent of a Brain must have an Academy Component attached to it!", MessageType.Error);
}
}
SerializedProperty bp = serializedBrain.FindProperty ("brainParameters");

if (myBrain.brainParameters.actionSize != myBrain.brainParameters.actionDescriptions.Count()) {
myBrain.brainParameters.actionDescriptions = new string[myBrain.brainParameters.actionSize];
}
serializedBrain.Update ();
EditorGUILayout.PropertyField (bp, true);
serializedBrain.ApplyModifiedProperties ();
serializedBrain.Update();
EditorGUILayout.PropertyField(bp, true);
myBrain.brainType = (BrainType)EditorGUILayout.EnumPopup ("Type Of Brain ", myBrain.brainType);
SerializedProperty bt = serializedBrain.FindProperty("brainType");
EditorGUILayout.PropertyField(bt);
if ((int)myBrain.brainType >= System.Enum.GetValues (typeof(BrainType)).Length) {
myBrain.brainType = BrainType.Player;
if (bt.enumValueIndex < 0) {
bt.enumValueIndex = (int)BrainType.Player;
serializedBrain.ApplyModifiedProperties();
myBrain.UpdateCoreBrains ();

正在加载...
取消
保存