diff --git a/org.janelia.easy-ml-agents/Editor/EasyMLSetup.cs b/org.janelia.easy-ml-agents/Editor/EasyMLSetup.cs
index 99e37da..e7d02c1 100644
--- a/org.janelia.easy-ml-agents/Editor/EasyMLSetup.cs
+++ b/org.janelia.easy-ml-agents/Editor/EasyMLSetup.cs
@@ -123,8 +123,8 @@ private static void Create(Type arenaType, Type agentType)
}
EasyMLSetupHelper helper = new EasyMLSetupHelper();
- arena.Setup(helper);
agent.Setup(helper);
+ arena.Setup(helper);
arena.PlaceRandomly();
diff --git a/org.janelia.easy-ml-agents/Editor/EasyMLSetupHelper.cs b/org.janelia.easy-ml-agents/Editor/EasyMLSetupHelper.cs
index 4d4e291..b97e884 100644
--- a/org.janelia.easy-ml-agents/Editor/EasyMLSetupHelper.cs
+++ b/org.janelia.easy-ml-agents/Editor/EasyMLSetupHelper.cs
@@ -181,7 +181,12 @@ public void CreatePhysicsMaterial(Collider collider, float staticFriction, float
public bool UsingURP()
{
- return (UnityEngine.Rendering.GraphicsSettings.renderPipelineAsset.GetType().Name == "UniversalRenderPipelineAsset");
+ UnityEngine.Rendering.RenderPipelineAsset pipeline = UnityEngine.Rendering.GraphicsSettings.renderPipelineAsset;
+ if (pipeline != null)
+ {
+ return (UnityEngine.Rendering.GraphicsSettings.renderPipelineAsset.GetType().Name == "UniversalRenderPipelineAsset");
+ }
+ return false;
}
}
}
diff --git a/org.janelia.easy-ml-agents/Runtime/EasyMLAgent.cs b/org.janelia.easy-ml-agents/Runtime/EasyMLAgent.cs
index 886bafc..6a63196 100644
--- a/org.janelia.easy-ml-agents/Runtime/EasyMLAgent.cs
+++ b/org.janelia.easy-ml-agents/Runtime/EasyMLAgent.cs
@@ -35,11 +35,15 @@ public abstract class EasyMLAgent : Agent
public abstract int VectorObservationSize { get; protected set; }
///
- /// The number of observations added in
- /// (and remember that one counts as 3 observations).
+ /// The number of continous actions.
///
public abstract int VectorActionSize { get; protected set; }
+ ///
+ /// The number of discrete actions.
+ ///
+ public abstract int[] DiscreteBranchSize { get; protected set; }
+
///
/// The size of the BoxCollider given to the agent by default. Note that a value S in
/// any of the dimensions means the box covers [-S/2, S/2] in that dimension.
@@ -167,7 +171,7 @@ public virtual void Setup(IEasyMLSetupHelper helper)
{
behavior.BehaviorName = BehaviorName;
behavior.BrainParameters.VectorObservationSize = VectorObservationSize;
- behavior.BrainParameters.ActionSpec = new ActionSpec(VectorActionSize);
+ behavior.BrainParameters.ActionSpec = new ActionSpec(VectorActionSize, DiscreteBranchSize);
const string SENSOR_OBJECT_NAME = "RaysForward";
diff --git a/org.janelia.easy-ml-agents/Runtime/EasyMLAgentGrounded.cs b/org.janelia.easy-ml-agents/Runtime/EasyMLAgentGrounded.cs
index db37442..88800f0 100644
--- a/org.janelia.easy-ml-agents/Runtime/EasyMLAgentGrounded.cs
+++ b/org.janelia.easy-ml-agents/Runtime/EasyMLAgentGrounded.cs
@@ -107,6 +107,12 @@ public override Vector3 ChildSensorSourceOffset
}
private Vector3 _groundedChildSensorSourceOffset = new Vector3(0, 0.05f, 0);
+ public virtual string BodyName
+ {
+ get { return _groundedBodyName; }
+ protected set { _groundedBodyName = value; }
+ }
+ private string _groundedBodyName = "Body";
///
/// Called after the Setup function for the arena (the class derived from ).
@@ -122,13 +128,13 @@ public override void Setup(Janelia.IEasyMLSetupHelper helper)
base.Setup(helper);
gameObject.name = "AgentGrounded";
- const string BODY_NAME = "Body";
- Transform bodyTransform = transform.Find(BODY_NAME);
+
+ Transform bodyTransform = transform.Find(BodyName);
GameObject body;
if (bodyTransform == null)
{
body = new GameObject();
- body.name = BODY_NAME;
+ body.name = BodyName;
body.transform.parent = transform;
}
else
@@ -221,9 +227,9 @@ public override void Heuristic(in ActionBuffers actionsOut)
Debug.Assert(VectorActionSize == 2, "Incorrect vector action size");
- ActionSegment continuouActions = actionsOut.ContinuousActions;
- continuouActions[0] = moveChange;
- continuouActions[1] = yawChange;
+ ActionSegment continuousActions = actionsOut.ContinuousActions;
+ continuousActions[0] = moveChange;
+ continuousActions[1] = yawChange;
}
}
}
\ No newline at end of file