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>

Classes

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

Namespaces

 AZ
 Reopen namespace to define DataPatch class.
 

Macros

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

Typedefs

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

◆ AZ_COMPONENT

#define AZ_COMPONENT (   _ComponentClass,
  ... 
)
Value:
AZ_RTTI(_ComponentClass, __VA_ARGS__, AZ::Component) \
AZ_COMPONENT_INTRUSIVE_DESCRIPTOR_TYPE(_ComponentClass) \
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.

◆ AZ_COMPONENT_BASE

#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.

◆ AZ_COMPONENT_INTRUSIVE_DESCRIPTOR_TYPE

#define AZ_COMPONENT_INTRUSIVE_DESCRIPTOR_TYPE (   _ComponentClass)
Value:
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.

AZ::ComponentDescriptorDefault
Definition: Component.h:506
AZ::Component
Definition: Component.h:41