Skip to content

Commit

Permalink
adding check for unity_proc prior to calling ChangeResolution to hand…
Browse files Browse the repository at this point in the history
…le case when Python client is running against the Unity Editor
  • Loading branch information
Eric Kolve committed Dec 15, 2021
1 parent db85652 commit 6f00529
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions ai2thor/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ def __init__(self):
self.server_types = ["FIFO", "WSGI"]
self.url = None
self.unity_proc = None
external_system_platforms = dict(Linux=Linux64, Darwin=OSXIntel64)
self.platform = external_system_platforms[platform.system()]

def download(self):
pass
Expand Down
6 changes: 4 additions & 2 deletions ai2thor/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,9 @@ def key_sort_func(scene_name):
# with CloudRendering the command-line height/width aren't respected, so
# we compare here with what the desired height/width are and
# update the resolution if they are different
if (
# if Python is running against the Unity Editor then
# ChangeResolution won't have an affect, so it gets skipped
if (self.server.unity_proc is not None) and (
target_width != self.last_event.screen_width
or target_height != self.last_event.screen_height
):
Expand Down Expand Up @@ -1304,7 +1306,7 @@ def start(
self.last_event = self.server.receive()

# we should be able to get rid of this since we check the resolution in .reset()
if height < 300 or width < 300:
if self.server.unity_proc is not None and (height < 300 or width < 300):
self.last_event = self.step("ChangeResolution", x=width, y=height)

return self.last_event
Expand Down

0 comments on commit 6f00529

Please sign in to comment.