Menu
Lumberyard
C++ API Reference (Version 1.10)

Component.h File Reference

Header file for the Component base class. More...

Classes

class  AZ::Component
 Base class for all components. More...
 
class  AZ::ComponentDescriptor
 Provides an interface through which the system can get the details of a component and reflect the component data to a variety of contexts. More...
 
struct  AZ::ComponentDescriptorBusTraits
 Describes the properties of the component descriptor event bus. More...
 
class  AZ::ComponentDescriptorHelper< ComponentClass >
 Helps you create a custom implementation of a descriptor. More...
 
class  AZ::ComponentDescriptorDefault< ComponentClass >
 Default descriptor implementation. More...
 

Namespaces

 AZ
 

Macros

#define AZ_COMPONENT_BASE(_ComponentClass, ...)
 Includes the core component code required to make a component work. More...
 
#define AZ_COMPONENT_INTRUSIVE_DESCRIPTOR_TYPE(_ComponentClass)
 Declares a descriptor class. More...
 
#define AZ_COMPONENT(_ComponentClass, ...)
 Declares a component with the default settings. More...
 

Typedefs

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

Detailed Description

Header file for the Component base class.

In Lumberyard'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,
  ... 
)

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)

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.