Skip to content

UnityActionException: behavior 3DBall?team=1 needs a continuous input of dimension (0, 2) #5204

@nagybalint25

Description

@nagybalint25

Running a version of 3DBall, where I've deleted all agents except for one. Whenever I issue an action using Gym (with the wrapper), for example taking a random action using

env.action_space.sample()

I get an error:

The behavior 3DBall?team=1 needs a continuous input of dimension (0, 2) for (<number of agents>, <action size>) but received input of dimension (1, 2)

There clearly is an agent in my executable, and mlagents-learn works fine too.

My code is as follows:


from mlagents_envs.environment import UnityEnvironment
from gym_unity.envs import UnityToGymWrapper
gym.logger.set_level(40)

def main():
    unity_env = UnityEnvironment(file_name="3dballv2")
    env = UnityToGymWrapper(unity_env,  uint8_visual=True,allow_multiple_obs=True)
    env.reset()
    for _ in range(1000):
        env.render()
        env.step(env.action_space.sample()) #random action
    env.close()    
    


if __name__ == '__main__':
    main()

Environment:

  • Unity Version: Unity 2020.1f1
  • OS + version: Windows 10
  • ML-Agents version: Release 15
  • Torch version: 1.7.1
  • Environment: 3DBalls

Metadata

Metadata

Assignees

Labels

bugIssue describes a potential bug in ml-agents.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions