Closed graybob closed 4 years ago
Hi @graybob, Do you see anything in the Unity Console or python output when the scene is reloaded after the bird game object is destroyed?
Hi , Yes , The log is as below.. (Using ML-Agents Beta 0.15.1)
Fewer observations (0) made than vector observation size (3). The observations will be padded.
UnityEngine.Debug:LogWarningFormat(String, Object[])
MLAgents.Sensors.VectorSensor:Write(WriteAdapter) (at Assets/com.unity.ml-agents/Runtime/Sensors/VectorSensor.cs:50)
MLAgents.GrpcExtensions:GetObservationProto(ISensor, WriteAdapter) (at Assets/com.unity.ml-agents/Runtime/Communicator/GrpcExtensions.cs:222)
MLAgents.RpcCommunicator:PutObservations(String, AgentInfo, List1) (at Assets/com.unity.ml-agents/Runtime/Communicator/RpcCommunicator.cs:284) MLAgents.Policies.RemotePolicy:RequestDecision(AgentInfo, List
1) (at Assets/com.unity.ml-agents/Runtime/Policies/RemotePolicy.cs:33)
MLAgents.Agent:NotifyAgentDone(DoneReason) (at Assets/com.unity.ml-agents/Runtime/Agent.cs:324)
MLAgents.Agent:OnDisable() (at Assets/com.unity.ml-agents/Runtime/Agent.cs:311)
Thanks
edit: I had the wrong code in the FixedUpdate
method.
Hi @graybob, We've logged this issue internally as MLA-874. We will work on this and update this thread when it's fixed.
In the time being, you can turn off the Academy Automatic Stepping and call RequestDecision in your Agent's FixedUpdate method for now.
In your Agent:
protected override void Initialize()
{
Academy.Instance.AutomaticSteppingEnabled = false;
}
void FixedUpdate()
{
Academy.Instance.EnvironmentStep();
}
Let me know if this workaround helps you move forward.
Hi ,
Yes this Workaround works good , the above warning messages are gone and Bird continues to train. :):)
Thanks.
Hi ,
I also figured out that Ray Perception Sensor Component 2D attached to bird stops working as soon as "SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);" is triggered.
I could see raycast fine till bird died(once) , once bird dies Scecemanager is triggered to reload the scene , once this happens the raycast vanishes .
I cant train without raycast.
Thanks
Hi @graybob, This issue was addressed in the latest release. Could you give it a try and see if the issue persists?
Hi ,
:) Great the fix works in latest release . Please close the issue .
Thanks 👍
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Hi ,
I was converting Unity FappyBird to Unity MLagent Environament and I am facing Issue as soon as SceneManager() triggered when Bird gameobject is dead,
Issue -> The UnityML stops collecting observations and agent stops responding .
Steps to Create issue.
1) Download Unity Flappybird @ https://assetstore.unity.com/packages/templates/flappy-bird-style-example-game-80330
2) Create a Empty game object (Rename to Bird_Agent) and make it child of Bird .
3) I am adding Bird_agent, Bird and GameControl modified code below , Please replace code from original project .
4) Start training , you will see that Bird fine till its dead , once Bird is dead UnityML stops collecting observations (Expecting Bird should start training again).
Thanks.