Difference between PIE and Standalone

I’m relatively new to UE4 and I’m trying to figure out what is happening in my game. Basically, I created myself a simple class called TransitionManager that inherits UObject. I have my GameInstance class (MyGameInstance) that instanciate this object like so :

mTransitionManager = ConstructObject<UTransitionManager>(UTransitionManager::StaticClass());

The MyGameInstance does that in the overided Init or InitPIE function (depending on which mode is played).

Basically the transitionManager object is then working as intended in PIE, and crashing in standalone.

Here is one example :

I have this function in TransitionManager:

void UTransitionManager::SwitchMap(FString aMapName, float aTransitionInTime, float aMinimumStayTime, float aTransitionOutTime)
	mMapReady = false;
	mTransitionTimer = aTransitionInTime;
	mTransitionInTime = aTransitionInTime;
	mTransitionOutTime = aTransitionOutTime;
	mTransitionStayTime = aMinimumStayTime;
	mCurrentTransitionState = TRANSITION_STATE_IN;
        mNextMap = aMapName;

Which works perfectly fine in PIE, it crashes on mNextMap = aMapName; in Standalone, basically because mNextMap (which is a FString) is invallid, for whatever reason.

I’ve done a lot of things trying to figure this out, but I’m kinda convice now that this is not “normal” behavior.

I’m concern this may have something to do with the GameInstance class, but I have no way to prove it has of yet.

Please, anyone, do you have a hint on why this is happening???

Well I just found my answer : basically the UPROPERTY() macro is very freaking important so that it does not GC anything. I thought it was only useful to set some “settings” like if its visible in blueprint or not and stuff like that. When I wanted to use defaults, I thought not using UPROPERTY() was OK. Looks like I was dead wrong!

Bascially : use UPROPERTY() everywhere!

I hope this can be useful to someone one day…