To track this down I disbled all of my ticks and only created my character nothing extra in the scene. After a given amount of time the de-constructor is called on my objects. This just started in 4.3 no code changes we made out side of needing to implement the headers of some AI modules with:
#include "BehaviorTree/BlackboardComponent.h"
#include "BehaviorTree/BehaviorTreeComponent.h"
#include "BehaviorTree/BehaviorTree.h"
#include "AI_Character.h"
And needing to move this from the constructor to begin play.
void ARPG_State::BeginPlay()
{
RPG_DATABASE_CONTROLLER = NewObject<URPG_Database>(this, URPG_Database::StaticClass());
RPG_PARTY_CONTROLLER = NewObject<URPG_Party>(this, URPG_Party::StaticClass());
Super::BeginPlay();
}
Please note that the items that are deleted are located in URPG_Party.
The objectes in question are UObjects that are created in said class:
#include "Object.h"
#include "RPG_Structs.h"
#include "RPG_Database.h"
#include "AI_Monster.h"
#include "RPG_Inventory.h"
#include "RPG_Armor.h"
#include "RPG_PartyMembers.h"
#include "RPG_Party.generated.h"
/**
*
*/
UCLASS(Blueprintable, BlueprintType)
class URPG_Party : public UObject
{
GENERATED_UCLASS_BODY()
private :
//Item Inventory
TSubobjectPtr<class URPG_Inventory> ItemInv;
//Party Equipment
TSubobjectPtr<class URPG_Armor> ArmorInv;
//Party Memebers
TSubobjectPtr<class URPG_PartyMembers> PartyMem;
public :
~URPG_Party();
//Database variables
FString DB_SOURCE_PATH;
FString DB_ACTIVE_PATH;
FString DB_SAVE_PATH;
FString DB_SOURCE;
FString DB_ACTIVE;
FString DB_SAVESLOT1;
FString DB_SAVESLOT2;
FString DB_SAVESLOT3;
FString SourceDataBase;
FString CurrentDataBase;
URPG_Database* RPG_DATABASE_CONTROLLER;
The objects ItemInv,ArmorInv, and PartyMem are the ones being deleted some how. The implementation for their object is standard:
URPG_Party::URPG_Party(const class FPostConstructInitializeProperties& PCIP)
: Super(PCIP)
{
ItemInv = PCIP.CreateDefaultSubobject<URPG_Inventory>(this, TEXT("ItemInv"));
ArmorInv = PCIP.CreateDefaultSubobject<URPG_Armor>(this, TEXT("ArmorInv"));
PartyMem = PCIP.CreateDefaultSubobject<URPG_PartyMembers>(this, TEXT("PartyMem"));
This has worked in the past the only thing i can think of is if something is deprecated but I see no warnings on compile.
Also note that after these objects are deleted the main class URPG_Party is still in tact no other visible corruptions in the variables. And this is not deleted until i click stop in the editor. When breaking on the de-constructor I examined all variables created in this object and the only invalid ones are the 3 pointers…
I can’t seem to figure out what is calling the de-constructor on these objects. Especially since I have nothing running in my BPs. I just create the objects and they sit there and nothing is happening then they just get deleted.
Attached is an image of the call stack if it helps: