Updated the SystemComponents in the Default Gem and Project Templates to initialize/deinitialize the Interface instance
This commit is contained in:
@@ -25,6 +25,22 @@ namespace ${SanitizedCppName}
|
||||
}
|
||||
}
|
||||
|
||||
${SanitizedCppName}EditorSystemComponent::${SanitizedCppName}EditorSystemComponent()
|
||||
{
|
||||
if (${SanitizedCppName}Interface::Get() == nullptr)
|
||||
{
|
||||
${SanitizedCppName}Interface::Register(this);
|
||||
}
|
||||
}
|
||||
|
||||
${SanitizedCppName}EditorSystemComponent::~${SanitizedCppName}EditorSystemComponent()
|
||||
{
|
||||
if (${SanitizedCppName}Interface::Get() == this)
|
||||
{
|
||||
${SanitizedCppName}Interface::Unregister(this);
|
||||
}
|
||||
}
|
||||
|
||||
void ${SanitizedCppName}EditorSystemComponent::Activate()
|
||||
{
|
||||
AzToolsFramework::EditorEvents::Bus::Handler::BusConnect();
|
||||
|
||||
@@ -29,7 +29,8 @@ namespace ${SanitizedCppName}
|
||||
AZ_COMPONENT(${SanitizedCppName}EditorSystemComponent, "${EditorSysCompClassId}");
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
|
||||
${SanitizedCppName}EditorSystemComponent() = default;
|
||||
${SanitizedCppName}EditorSystemComponent();
|
||||
~${SanitizedCppName}EditorSystemComponent();
|
||||
|
||||
private:
|
||||
static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
|
||||
|
||||
@@ -59,6 +59,22 @@ namespace ${SanitizedCppName}
|
||||
AZ_UNUSED(dependent);
|
||||
}
|
||||
|
||||
${SanitizedCppName}SystemComponent::${SanitizedCppName}SystemComponent()
|
||||
{
|
||||
if (${SanitizedCppName}Interface::Get() == nullptr)
|
||||
{
|
||||
${SanitizedCppName}Interface::Register(this);
|
||||
}
|
||||
}
|
||||
|
||||
${SanitizedCppName}SystemComponent::~${SanitizedCppName}SystemComponent()
|
||||
{
|
||||
if (${SanitizedCppName}Interface::Get() == this)
|
||||
{
|
||||
${SanitizedCppName}Interface::Unregister(this);
|
||||
}
|
||||
}
|
||||
|
||||
void ${SanitizedCppName}SystemComponent::Init()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -35,6 +35,9 @@ namespace ${SanitizedCppName}
|
||||
static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
|
||||
static void GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent);
|
||||
|
||||
${SanitizedCppName}SystemComponent();
|
||||
~${SanitizedCppName}SystemComponent();
|
||||
|
||||
protected:
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// ${SanitizedCppName}RequestBus interface implementation
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace ${SanitizedCppName}
|
||||
${SanitizedCppName}Interface::Register(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
${SanitizedCppName}SystemComponent::~${SanitizedCppName}SystemComponent()
|
||||
{
|
||||
if (${SanitizedCppName}Interface::Get() == this)
|
||||
|
||||
Reference in New Issue
Block a user