Navigation
API > API/Plugins > API/Plugins/LearningAgents
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.
| Name | ULearningAgentsManager |
| Type | class |
| Header File | /Engine/Plugins/Experimental/LearningAgents/Source/LearningAgents/Public/LearningAgentsManager.h |
| Include Path | #include "LearningAgentsManager.h" |
Syntax
UCLASS (MinimalAPI, BlueprintType, Blueprintable, Meta=(BlueprintSpawnableComponent))
class ULearningAgentsManager : public UActorComponent
Inheritance Hierarchy
- UObjectBase → UObjectBaseUtility → UObject → UActorComponent → ULearningAgentsManager
Implements Interfaces
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
| These constructors/destructors are needed to make forward declarations happy. | LearningAgentsManager.h | ||
ULearningAgentsManager
(
FVTableHelper& Helper |
LearningAgentsManager.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual ~ULearningAgentsManager() |
LearningAgentsManager.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| Agents | TArray< TObjectPtr< UObject > > | The list of current agents. | LearningAgentsManager.h |
|
| Listeners | TArray< TObjectPtr< ULearningAgentsManagerListener > > | The list of current listeners. | LearningAgentsManager.h |
|
| OccupiedAgentIds | TArray< int32 > | Array of agent ids currently in use and associated with each agent object. | LearningAgentsManager.h | |
| OccupiedAgentSet | UE::Learning::FIndexSet | LearningAgentsManager.h | ||
| OnEventAgentIds | TArray< int32 > | Array of agent ids to be passed to events such as ULearningAgentsManagerListener::OnAgentAdded. | LearningAgentsManager.h | |
| VacantAgentIds | TArray< int32 > | Array of agent ids currently free and available for assignment. | LearningAgentsManager.h | |
| VacantAgentSet | UE::Learning::FIndexSet | LearningAgentsManager.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
int32 AddAgent
(
UObject* Agent |
Adds the given object as an agent to the manager. | LearningAgentsManager.h |
|
| Adds the given objects as an agents to the manager. | LearningAgentsManager.h |
|
|
void AddListener
(
ULearningAgentsManagerListener* Listener |
Adds a listener to be tracked by this manager. | LearningAgentsManager.h |
|
UObject * GetAgent
(
const int32 AgentId, |
Gets the agent with the given id. | LearningAgentsManager.h |
|
| Gets the agent corresponding to the given id. | LearningAgentsManager.h | ||
| -- Non-blueprint public interface -- | LearningAgentsManager.h | ||
int32 GetAgentId
(
UObject* Agent |
Gets the agent id associated with a given agent. | LearningAgentsManager.h |
|
| Gets the agent ids associated with a set of agents. | LearningAgentsManager.h |
|
|
int32 GetAgentNum() |
Gets the number of agents added | LearningAgentsManager.h |
|
| Gets the agents associated with a set of ids. | LearningAgentsManager.h |
|
|
TConstArrayView< TObjectPtr< UObject > > GetAgents () |
Get a const array view of this manager's agent objects. | LearningAgentsManager.h | |
const TArray< int32 > & GetAllAgentIds() |
Gets the set of agent ids currently added | LearningAgentsManager.h | |
void GetAllAgents
(
TArray< UObject* >& OutAgents, |
Gets all added agents. | LearningAgentsManager.h |
|
UE::Learning::FIndexSet GetAllAgentSet() |
Gets the set of agent ids currently added as an FIndexSet | LearningAgentsManager.h | |
int32 GetMaxAgentNum () |
-- Agent Management -- | LearningAgentsManager.h |
|
bool HasAgent
(
const int32 AgentId |
Returns true if the given id is an agent used by the manager; Otherwise, false. | LearningAgentsManager.h |
|
bool HasAgentObject
(
UObject* Agent |
Returns true if the given object is an agent used by the manager; Otherwise, false. | LearningAgentsManager.h |
|
void RemoveAgent
(
const int32 AgentId |
Removes the agent with the given id from the manager. | LearningAgentsManager.h |
|
void RemoveAgents
(
const TArray< int32 >& AgentIds |
Removes the agents with the given ids from the manager. | LearningAgentsManager.h |
|
void RemoveAllAgents() |
Removes all agents from the manager. | LearningAgentsManager.h |
|
void RemoveListener
(
ULearningAgentsManagerListener* Listener |
Removes a listener from being tracked by this manager. | LearningAgentsManager.h |
|
void RequestAddAgent
(
UObject* Agent |
Schedules a task to add the given object as an agent to the manager, preventing synchronous mutations of agent arrays on the game thread. | LearningAgentsManager.h |
|
void RequestRemoveAgent
(
const int32 AgentId |
Schedules a task to remove the agent with the given ID from the manager, preventing synchronous mutations of agent arrays on the game thread. | LearningAgentsManager.h |
|
void ResetAgent
(
const int32 AgentId |
Resets the agent with the given id on the manager. | LearningAgentsManager.h |
|
void ResetAgents
(
const TArray< int32 >& AgentIds |
Resets the agents with the given ids on the manager. | LearningAgentsManager.h |
|
void ResetAllAgents() |
Resets all the agents on the manager. | LearningAgentsManager.h |
|
void SetMaxAgentNum
(
const int32 InMaxAgentNum |
Sets the maximum number of agents that this manager is configured to handle. | LearningAgentsManager.h |
|
Overridden from UActorComponent
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void OnRegister() |
LearningAgentsManager.h | ||
virtual void TickComponent
(
float DeltaTime, |
LearningAgentsManager.h |