Skip to content

Commit 5d1c1e1

Browse files
vincentpierreErvin Teng
authored andcommitted
[Bug Fix] Issue 5204 : GymToUnityWrapper must call reset if done (#5207)
(cherry picked from commit 21548e0)
1 parent f699d8d commit 5d1c1e1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

gym-unity/gym_unity/envs/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,12 @@ def step(self, action: List[Any]) -> GymStepResult:
174174
done (boolean/list): whether the episode has ended.
175175
info (dict): contains auxiliary diagnostic information.
176176
"""
177+
if self.game_over:
178+
raise UnityGymException(
179+
"You are calling 'step()' even though this environment has already "
180+
"returned done = True. You must always call 'reset()' once you "
181+
"receive 'done = True'."
182+
)
177183
if self._flattener is not None:
178184
# Translate action into list
179185
action = self._flattener.lookup_action(action)

0 commit comments

Comments
 (0)