Overview
The Unit System.
Set Up
Refer to the Unit Set Up Guide in Get Started section.
This is the multi-page printable view of this section. Click here to print.
The Unit System.
Refer to the Unit Set Up Guide in Get Started section.

Image showing the TargetingHandler component, as seen in the Entity Inspector.
// GameManagerGlobalEventBus
void OnSetupManagers() override;
void OnShutdownManagers() override;
void OnStartupComplete() override;
void OnEnterStandby() override;
void OnExitStandby() override;
// UnitManagerIncomingEventBus
void RequestSpawnNewUnit(AZ::EntityId callingEntityId, AzFramework::Scripts::SpawnableScriptAssetRef unitPrefab, AZ::EntityId spawnParentEntityId) override;
bool CheckIsUnit(AZ::EntityId unitId) override;

Image showing the TargetingHandler component, as seen in the Entity Inspector.
// UnitControllerIncomingEventBus
void PossessUnit(AZ::EntityId targetUnit) override;
void DePossessUnit() override;
AZ::EntityId GetUnit() override { return possessedUnit; };
AZStd::string GetUniqueName() override { return uniqueName; };
// UnitManagerOutgoingEventBus
void ReturnNewUnit(AZ::EntityId caller, AZ::EntityId newUnit) override;
// Local Methods
virtual void PostActivateProcessing();
virtual void SetUniqueName();

Image showing the TargetingHandler component, as seen in the Entity Inspector.

Image showing an InputReactor component, as seen in the Entity Inspector.

Image showing a Player Input Reader component, as seen in the Entity Inspector.

Image showing the TargetingHandler component, as seen in the Entity Inspector.

Image showing the collision layers used for a unit collider, as seen in the Entity Inspector.
If you have not set up your PhysX Collision Layers or Groups yet. Refer to the Setting Up Your Project Environment guide.
// UnitIncomingEventBus
void Possess(AZ::EntityId possessingController) override;
void DePossess() override;
AZ::EntityId GetController() override { return owningController; };
AZStd::string GetUniqueName() override { return uniqueName; };
// Local Methods
virtual void SetUniqueName();

Image showing the TargetingHandler component, as seen in the Entity Inspector.
// UnitOutgoingEventBus
void UnitPossessed(AZ::EntityId possessingController) override;
// MoverContextIncomingEvents
void ChangeMovementMode(AZStd::string targetMoveMode) override;
void RevertToLastMovementMode() override;
void ChangeRotationMode(AZStd::string targetRotateMode) override;
void RevertToLastRotationMode() override;
void ChangeGroundingMode(AZStd::string targetRotateMode) override;
void RevertToLastGroundingMode() override;
void SetMoveInputAxis(AZStd::string axisName, float axisValue) override;
AZ::Vector2* GetMoveInputAxis() override { return &rawMoveInput; };
AZ::Vector3* GetModifiedMoveInputAxis() override { return &modifiedMoveInput; };
AZ::Vector3* GetGroundMoveInputAxis() override { return &groundedMoveInput; };
void SetGroundNormal(AZ::Vector3 newNormal) override;
AZ::Vector3* GetGroundNormal() override { return &groundNormal; };
AZ::Vector3* GetSlopeDirection() override { return &slopeDir; };
float* GetSlopeAngle() override { return &slopeAngle; };
float* GetMaxWalkAngle() override { return &maxWalkAngle; };
void SetMoverState(AZStd::string stateName, AZ::u32 stateValue) override;
AZ::u32 GetMoverState(AZStd::string stateName) override;
// Local Methods
virtual void ModifyInputAxis();
virtual void GroundInputAxis();

Image showing a Mover component, as seen in the Entity Inspector.
// MoverContextOutgoingEventBus
void MovementModeChanged(AZStd::string modeName) override;
void RotationModeChanged(AZStd::string modeName) override;
//Local Methods
virtual void ToggleMovement(bool on);
virtual void ToggleRotation(bool on);
virtual void HandleMovement();
virtual void HandleRotation();
virtual bool CheckCanOperate();

Image showing a 3D Free Mover component, as seen in the Entity Inspector.

Image showing the TargetingHandler component, as seen in the Entity Inspector.

Image showing the TargetingHandler component, as seen in the Entity Inspector.

Image showing the TargetingHandler component, as seen in the Entity Inspector.

Image showing the TargetingHandler component, as seen in the Entity Inspector.

Image showing a Grounder component, as seen in the Entity Inspector.
// MoverContextOutgoingEventBus
void GroundingModeChanged(AZStd::string modeName) override;
// Local Methods
virtual void ToggleGrounder(bool on);
virtual void HandleGrounding();
virtual void GroundingStateChange(AZ::u32 newState);
virtual bool CheckCanOperate();

Image showing a 3D Physics Ray Grounder, as seen in the Entity Inspector.