unreal.LearningAgentsManager
¶
- class unreal.LearningAgentsManager(outer: Object | None = None, name: Name | str = 'None')¶
Bases:
ActorComponent
The agent manager is responsible for tracking which game objects are agents. It’s the central class around which most of Learning Agents is built.
If you have multiple different types of objects you want controlled by Learning Agents, you should consider creating one agent manager per object type, rather than trying to share an agent manager.
C++ Source:
Plugin: LearningAgents
Module: LearningAgents
File: LearningAgentsManager.h
Editor Properties: (see get_editor_property/set_editor_property)
agents
(Array[Object]): [Read-Only] The list of current agents.asset_user_data
(Array[AssetUserData]): [Read-Write] Array of user data stored with the componentasset_user_data_editor_only
(Array[AssetUserData]): [Read-Write] Array of user data stored with the componentauto_activate
(bool): [Read-Write] Whether the component is activated at creation or must be explicitly activated.can_ever_affect_navigation
(bool): [Read-Write] Whether this component can potentially influence navigationcomponent_tags
(Array[Name]): [Read-Write] Array of tags that can be used for grouping and categorizing. Can also be accessed from scripting.editable_when_inherited
(bool): [Read-Write] True if this component can be modified when it was inherited from a parent actor classis_editor_only
(bool): [Read-Write] If true, the component will be excluded from non-editor buildslisteners
(Array[LearningAgentsManagerListener]): [Read-Only] The list of current listeners.max_agent_num
(int32): [Read-Write] Maximum number of agents. Used to preallocate internal buffers. Setting this higher will allow more agents but use up more memory.on_component_activated
(ActorComponentActivatedSignature): [Read-Write] Called when the component has been activated, with parameter indicating if it was from a reseton_component_deactivated
(ActorComponentDeactivateSignature): [Read-Write] Called when the component has been deactivatedprimary_component_tick
(ActorComponentTickFunction): [Read-Write] Main tick function for the Componentreplicate_using_registered_sub_object_list
(bool): [Read-Write] When true the replication system will only replicate the registered subobjects list When false the replication system will instead call the virtual ReplicateSubObjects() function where the subobjects need to be manually replicated.replicates
(bool): [Read-Write] Is this component currently replicating? Should the network code consider it for replication? Owning Actor must be replicating first!
- add_agent(agent) int32 ¶
Adds the given object as an agent to the manager.
- Parameters:
agent (Object) – The object to be added.
- Returns:
The agent’s newly assigned id.
- Return type:
int32
- add_listener(listener) None ¶
Adds a listener to be tracked by this manager.
- Parameters:
listener (LearningAgentsManagerListener) –
- get_agent(agent_id=-1, agent_class) Object ¶
Gets the agent with the given id. Calling this from blueprint with the appropriate AgentClass will automatically cast the object to the given type. If not in a blueprint, you should use one of the other GetAgent overloads.
- get_agent_id(agent) int32 ¶
Gets the agent id associated with a given agent.
- Parameters:
agent (Object) – The agent object.
- Returns:
The agent id.
- Return type:
int32
- get_agent_num() int32 ¶
Gets the number of agents added
- Returns:
The number of agents added.
- Return type:
int32
- get_agents(agent_ids, agent_class) Array[Object] ¶
Gets the agents associated with a set of ids. Calling this from blueprint with the appropriate AgentClass will automatically cast the object to the given type.
- get_all_agents(agent_class) -> (out_agents=Array[Object], out_agent_ids=Array[int32])¶
Gets all added agents. Calling this from blueprint with the appropriate AgentClass will automatically cast the object to the given type.
- get_max_agent_num() int32 ¶
Returns the maximum number of agents that this manager is configured to handle.
- Return type:
int32
- has_agent(agent_id=-1) bool ¶
Returns true if the given id is an agent used by the manager; Otherwise, false.
- Parameters:
agent_id (int32) –
- Return type:
- has_agent_object(agent) bool ¶
Returns true if the given object is an agent used by the manager; Otherwise, false.
- remove_agent(agent_id=-1) None ¶
Removes the agent with the given id from the manager.
- Parameters:
agent_id (int32) – The id of the agent to remove.
- remove_agents(agent_ids) None ¶
Removes the agents with the given ids from the manager.
- Parameters:
agent_ids (Array[int32]) – The ids of the agents to remove.
- remove_listener(listener) None ¶
Removes a listener from being tracked by this manager.
- Parameters:
listener (LearningAgentsManagerListener) –
- reset_agent(agent_id=-1) None ¶
Resets the agent with the given id on the manager. Used to tell components to reset any state associated with this agent.
- Parameters:
agent_id (int32) – The id of the agent to reset.