From ee5b1432ec5eb27460b964b687769ad3eff0bff9 Mon Sep 17 00:00:00 2001 From: vincentpierre Date: Tue, 9 Jun 2020 11:57:25 -0700 Subject: [PATCH] Reverting bug introduced in #4071 --- com.unity.ml-agents/Runtime/Academy.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/com.unity.ml-agents/Runtime/Academy.cs b/com.unity.ml-agents/Runtime/Academy.cs index 92440e2a9d..d1cfd26275 100644 --- a/com.unity.ml-agents/Runtime/Academy.cs +++ b/com.unity.ml-agents/Runtime/Academy.cs @@ -366,8 +366,6 @@ void InitializeEnvironment() port = port } ); - Communicator.QuitCommandReceived += OnQuitCommandReceived; - Communicator.ResetCommandReceived += OnResetCommand; } if (Communicator != null) @@ -400,6 +398,11 @@ void InitializeEnvironment() Communicator = null; } } + if (Communicator != null) + { + Communicator.QuitCommandReceived += OnQuitCommandReceived; + Communicator.ResetCommandReceived += OnResetCommand; + } // If a communicator is enabled/provided, then we assume we are in // training mode. In the absence of a communicator, we assume we are