Getting data from struct crahses IOS game


I have made a struct in c++, this struct contains information about worlds in my game, because the player is able to switch worlds instantly and I am using 1 persistent level with sub levels. Then in my game instance class, I have the following TArray:

* Array holding the data of all the worlds, data is set in the game instance BP
UPROPERTY(BlueprintReadOnly, EditAnywhere, Category = "Worlds")
	TArray<FWorldData> Worlds;

The contents of this TArray are being coppied to an UnlockManager class which checks if the worlds are unlocked etc.


void UUnlockManager::PopulateWorldsArray(TArray<FWorldData> _worlds)
	Worlds = _worlds;

Now, one of the datatypes this struct is holding is the following:

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Level Data")
		UAnimBlueprintGeneratedClass* DefaultCharacterAnimClass;

Now, when I try to get the current game world (FWorldData struct) in my game mode, read it out in Blueprint and break the struct to get the DefaultCharacterAnimClass pointer variable… My game crashes.

FWorldData AEndlesRunnerGameMode::GetCurrentWorldData()
	return currentWorldData;

All the other contents of the struct read out fine, but getting that one crashes my game, and also, only on IOS. Not on windows, not on Mac, not while PIE.

Somehow when my game crashes, it won’t generate crash log files anymore on the IOS device, so I am kind of in the dark here…

I need that DefaultCharacterAnimClass because the mesh of the player is different in each world, and so I need to change the AnimationInstanceClass of that mesh to the correct animation blueprint so that the character is animated.

I hope this all makes sense to someone and that maybe someone know’s what’s going wrong here.

It will be very hard to debug this without a crash log…

Do you have access to other iOS devices with different iOS versions? Could it be that you don’t have space and for the same reason you can’t save a crash log? (highly implausible) Can you debug your game with a profiler on the device? (I really don’t know if it is possible) Could it be that you ran out of memory? Could it be that the graphic driver crashed? (it always outputs a log though)

Also there is a quirk in iOS that it automatically kills processes that do not respond for a few seconds. (lower threshold than any other OS and with no warning pop-up)

Also, when I try to pass the whole struct, It crashes… this did not happen before :frowning:

I just compiled my project from xcode, and then launched again via the ue4 editor, and voila… it works.
I don’t know how, I don’t know why… nothing changed except that I first compiled via xcode, which installed the game on my device, but that one crashes automatically after the splash screen because it only builds the source code, so all the other project files are missing…

Then I re opend the editor, launched from there and it works…

I am going to test a bit more, to see if this really was the fix, when it is, I will mark this question as resolved :slight_smile:

After some trial and error I figured out that when I build the game in Xcode first, and after that, launch it from the editor, everything works as intended.