My classes are being deleted by the engine after a set amount of time

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()); 

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

private :
	//Item Inventory
	TSubobjectPtr<class URPG_Inventory> ItemInv;
	//Party Equipment
	TSubobjectPtr<class URPG_Armor> ArmorInv;
	//Party Memebers
	TSubobjectPtr<class URPG_PartyMembers> PartyMem;
public :

	//Database variables
	FString SourceDataBase;
	FString CurrentDataBase;


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:

URL since the image is shrunk:
[link text][2]

Have you tried decorating the objects with UPROPERTY()?

I’ve had this issue, and declaring variables in the following way prevented the engine from garbage collecting them:

AMyClass* MyClassPointer;

Any reference to a UObject must be protected/marked up by a UPROPERTY tag to prevent garbage collection from tagging it for deletion. If you don’t do this, you must manually alert the garbage collection code to the connection to your class and manage its lifetime on your own.

See my response here. I also have a more detailed response here, but you’ll have to go a little bit through the comments of my answer to where I talked about AddReferencedObjects.