Skip to content

Instantly share code, notes, and snippets.

@evanthebouncy
Created March 23, 2026 15:03
Show Gist options
  • Select an option

  • Save evanthebouncy/aa6a0f0ff89ffd98d6c6237915a8753d to your computer and use it in GitHub Desktop.

Select an option

Save evanthebouncy/aa6a0f0ff89ffd98d6c6237915a8753d to your computer and use it in GitHub Desktop.
speedup
from mlagents_envs.environment import UnityEnvironment
from mlagents_envs.envs.unity_gym_env import UnityToGymWrapper
from mlagents_envs.side_channel.engine_configuration_channel import EngineConfigurationChannel
engine_channel = EngineConfigurationChannel()
unity_env = UnityEnvironment(
file_name=r"Simple/Assignment2", # use the path to your built game here
side_channels=[engine_channel],
no_graphics=False, # set to True to disable rendering, which can speed up training
)
engine_channel.set_configuration_parameters(time_scale=20.0)
env = UnityToGymWrapper(unity_env)
while True:
obs = env.reset()
done = False
while not done:
action = env.action_space.sample()
obs, reward, done, info = env.step(action)
print(obs, reward, done, info)
env.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment