Skip to content
This repository was archived by the owner on Aug 21, 2020. It is now read-only.

Ali test 0917 #1

Open
wants to merge 15 commits into
base: Ali_test_0917
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
14 changes: 14 additions & 0 deletions env/AnimalAI-Environment/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
AnimalAI-environment.sln
AnimalAIOlympics-PrivDev-UnitySDK.sln
Assembly-CSharp.csproj
Assembly-CSharp-Editor.csproj
iOSBLAS.csproj
Library
Logs
MacBLAS.csproj
obj
omnisharp.json
Packages
UIElementsSchema
.vscode
Temp
9 changes: 9 additions & 0 deletions env/AnimalAI-Environment/Assets/AnimalAIOlympics.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions env/AnimalAI-Environment/Assets/AnimalAIOlympics/Editor.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
using UnityEngine;
using UnityEditor;

namespace MLAgents
{
/*
This code is meant to modify the behavior of the inspector on Brain Components.
Depending on the type of brain that is used, the available fields will be modified in the inspector accordingly.
*/
[CustomEditor(typeof(Agent), true)]
[CanEditMultipleObjects]
public class AgentEditor : Editor
{

public override void OnInspectorGUI()
{
SerializedObject serializedAgent = serializedObject;
serializedAgent.Update();

SerializedProperty brain = serializedAgent.FindProperty("brain");
SerializedProperty actionsPerDecision = serializedAgent.FindProperty(
"agentParameters.numberOfActionsBetweenDecisions");
SerializedProperty maxSteps = serializedAgent.FindProperty(
"agentParameters.maxStep");
SerializedProperty isResetOnDone = serializedAgent.FindProperty(
"agentParameters.resetOnDone");
SerializedProperty isODD = serializedAgent.FindProperty(
"agentParameters.onDemandDecision");
SerializedProperty cameras = serializedAgent.FindProperty(
"agentParameters.agentCameras");

EditorGUILayout.PropertyField(brain);

EditorGUILayout.LabelField("Agent Cameras");
for (int i = 0; i < cameras.arraySize; i++)
{
EditorGUILayout.PropertyField(
cameras.GetArrayElementAtIndex(i),
new GUIContent("Camera " + (i + 1).ToString() + ": "));
}

EditorGUILayout.BeginHorizontal();
if (GUILayout.Button("Add Camera", EditorStyles.miniButton))
{
cameras.arraySize++;
}

if (GUILayout.Button("Remove Camera", EditorStyles.miniButton))
{
cameras.arraySize--;
}

EditorGUILayout.EndHorizontal();

EditorGUILayout.PropertyField(
maxSteps,
new GUIContent(
"Max Step", "The per-agent maximum number of steps."));
EditorGUILayout.PropertyField(
isResetOnDone,
new GUIContent(
"Reset On Done",
"If checked, the agent will reset on done. Else, AgentOnDone() will be called."));
EditorGUILayout.PropertyField(
isODD,
new GUIContent(
"On Demand Decisions",
"If checked, you must manually request decisions."));
if (!isODD.boolValue)
{
EditorGUILayout.PropertyField(
actionsPerDecision,
new GUIContent(
"Decision Interval",
"The agent will automatically request a decision every X" +
" steps and perform an action at every step."));
actionsPerDecision.intValue = Mathf.Max(1, actionsPerDecision.intValue);
}

serializedAgent.ApplyModifiedProperties();

EditorGUILayout.LabelField("", GUI.skin.horizontalSlider);
base.OnInspectorGUI();
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using UnityEngine;
using UnityEditor;


namespace MLAgents
{
/// <summary>
/// CustomEditor for the Brain base class. Defines the default Inspector view for a Brain.
/// Shows the BrainParameters of the Brain and expose a tool to deep copy BrainParameters
/// between brains.
/// </summary>
[CustomEditor(typeof(Brain))]
public class BrainEditor : Editor
{
public override void OnInspectorGUI()
{
var brain = (Brain) target;
var brainToCopy = EditorGUILayout.ObjectField(
"Copy Brain Parameters from : ", null, typeof(Brain), false) as Brain;
if (brainToCopy != null)
{
brain.brainParameters = brainToCopy.brainParameters.Clone();
EditorUtility.SetDirty(brain);
AssetDatabase.SaveAssets();
return;
}
var serializedBrain = serializedObject;
serializedBrain.Update();
EditorGUILayout.PropertyField(serializedBrain.FindProperty("brainParameters"), true);
serializedBrain.ApplyModifiedProperties();

// Draws a horizontal thick line
EditorGUILayout.LabelField("", GUI.skin.horizontalSlider);
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading