Fixed Script Event registration going to the incorrect Behavior Context

Signed-off-by: lsemp3d <58790905+lsemp3d@users.noreply.github.com>
This commit is contained in:
lsemp3d
2022-02-17 11:37:20 -08:00
parent a3e33f0c4f
commit 1ed513d782
3 changed files with 3 additions and 2 deletions
@@ -1337,6 +1337,7 @@ namespace AZ
// EBusInterface settings
static const EBusAddressPolicy AddressPolicy = EBusAddressPolicy::ById;
typedef BehaviorContext* BusIdType;
using MutexType = AZStd::recursive_mutex;
//////////////////////////////////////////////////////////////////////////
/// Called when a new global method is reflected in behavior context or removed from it
@@ -39,7 +39,7 @@ namespace AZ
// [GFX TODO][ATOM-13648] Add local system allocator to material system
// ScriptContext creates a new allocator if null (default) is passed in.
// Temporarily using system allocator for preventing hitting the max allocator number.
m_scriptContext = AZStd::make_unique<AZ::ScriptContext>(ScriptContextIds::DefaultScriptContextId, &AZ::AllocatorInstance<AZ::SystemAllocator>::Get());
m_scriptContext = AZStd::make_unique<AZ::ScriptContext>(AZ_CRC_CE("MaterialFunctor"), &AZ::AllocatorInstance<AZ::SystemAllocator>::Get());
m_sriptBehaviorContext = AZStd::make_unique<AZ::BehaviorContext>();
ReflectScriptContext(m_sriptBehaviorContext.get());
@@ -115,7 +115,7 @@ namespace ScriptEvents
m_maxVersion = definition.GetVersion();
}
AZ::BehaviorContextBus::Broadcast(&AZ::BehaviorContextBus::Events::OnAddEBus, m_busName.c_str(), bus);
AZ::BehaviorContextBus::Event(behaviorContext, &AZ::BehaviorContextBus::Events::OnAddEBus, m_busName.c_str(), bus);
m_scriptEventBindings[m_assetId] = AZStd::make_unique<ScriptEventBinding>(behaviorContext, m_busName.c_str(), definition.GetAddressType());
ScriptEventNotificationBus::Event(m_assetId, &ScriptEventNotifications::OnRegistered, definition);