Open 3D Engine AzCore API Reference  2205.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
Classes | Namespaces | Macros | Typedefs
Component.h File Reference
#include <AzCore/Component/ComponentBus.h>
#include <AzCore/Component/NamedEntityId.h>
#include <AzCore/RTTI/ReflectContext.h>
#include <AzCore/Memory/Memory.h>
#include <AzCore/Memory/SystemAllocator.h>
#include <AzCore/Outcome/Outcome.h>
#include <AzCore/std/containers/unordered_set.h>


class  AZ::Component
class  AZ::ComponentDescriptor
struct  AZ::ComponentDescriptorBusTraits
class  AZ::ComponentDescriptorHelper< ComponentClass >
class  AZ::ComponentDescriptorDefault< ComponentClass >


 Reopen namespace to define DataPatch class.


#define AZ_COMPONENT_BASE(_ComponentClass, ...)
#define AZ_COMPONENT(_ComponentClass, ...)


typedef AZ::u32 AZ::ComponentServiceType
 ID of a user-defined component service. The system uses it to build a dependency tree.
using AZ::ImmutableEntityVector = AZStd::vector< AZ::Entity const * >
using AZ::ComponentTypeList = AZStd::vector< Uuid >
 List of Component class type IDs.
using AZ::ComponentValidationResult = AZ::Outcome< void, AZStd::string >
typedef AZ::EBus< ComponentDescriptor, ComponentDescriptorBusTraits > AZ::ComponentDescriptorBus

Detailed Description

Header file for the Component base class. In Open 3D Engine's component entity system, each component defines a discrete
feature that can be attached to an entity.

Macro Definition Documentation


#define AZ_COMPONENT (   _ComponentClass,
AZ_RTTI(_ComponentClass, __VA_ARGS__, AZ::Component) \
AZ_COMPONENT_BASE(_ComponentClass, __VA_ARGS__)

Declares a component with the default settings. The component derives from AZ::Component, is not templated, uses AZ::SystemAllocator, and so on. AZ_COMPONENT(_ComponentClass, _ComponentId, OtherBaseClases... Component) is included automatically.

The component that this macro creates has a static function called CreateDescriptor and a type called DescriptorType. Although you can delete the descriptor, keep in mind that you cannot use component instances without a descriptor. This is because descriptors are released when the component application closes or a module is unloaded. Descriptors must have access to AZ::ComponentDescriptor::Reflect, AZ::ComponentDescriptor::GetProvidedServices, and other descriptor services.

You are not required to use the AZ_COMPONENT macro if you want to implement your own creation functions by calling AZ_CLASS_ALLOCATOR, AZ_RTTI, and so on.


#define AZ_COMPONENT_BASE (   _ComponentClass,

Includes the core component code required to make a component work. This macro is typically included in other macros, such as AZ_COMPONENT, to create a component.


friend class AZ::ComponentDescriptorDefault<_ComponentClass>; \

Declares a descriptor class.
Unless you are implementing very advanced internal functionality, we recommend using AZ_COMPONENT instead of this macro. This macro enables you to implement a static function in the Component class instead of writing a descriptor. It defines a CreateDescriptorFunction that you can call to register a descriptor. (Only one descriptor can exist per environment.) This macro fails silently if you implement the functions with the wrong signatures.

Definition: Component.h:506
Definition: Component.h:41