From bd91b8fd85d03c7a7845020d1fcf069dd89d473f Mon Sep 17 00:00:00 2001 From: Anton Tarasenko Date: Mon, 8 Mar 2021 02:13:46 +0700 Subject: [PATCH] Comment about calling `AcediaActor`'s constructors --- sources/Memory/MemoryAPI.uc | 3 +++ sources/Types/AcediaActor.uc | 3 +++ 2 files changed, 6 insertions(+) diff --git a/sources/Memory/MemoryAPI.uc b/sources/Memory/MemoryAPI.uc index 03a09f5..3fa3b72 100644 --- a/sources/Memory/MemoryAPI.uc +++ b/sources/Memory/MemoryAPI.uc @@ -106,6 +106,9 @@ public final function Object Allocate( AcediaObject(allocatedObject)._constructor(); } if (acediaActorClassToAllocate != none) { + // Despite `_constructor()` being called during `PreBeginPlay()` event, + // we must also call it here for `Actor`s that we did not spawn anew, + // but took from object pool. AcediaActor(allocatedObject)._constructor(); } return allocatedObject; diff --git a/sources/Types/AcediaActor.uc b/sources/Types/AcediaActor.uc index 126314d..48479f5 100644 --- a/sources/Types/AcediaActor.uc +++ b/sources/Types/AcediaActor.uc @@ -412,6 +412,9 @@ public static final function Global __() event PreBeginPlay() { super.PreBeginPlay(); + // Calling this early here makes sure `Actor`s that catch `PreBeginPlay()` + // and similar early initialization events will find global API already + // setup and working _constructor(); }