Crash calling LoadObject

Since update 4.8.3, we’ve been getting random, but consistent crashes in LoadObject function. We use LoadObject to load random “items” during runtime.

the “Index” is always 19.

Hello ,

I have a few questions for you to get started on looking into this issue.

  1. Did this begin with a certain engine version? If so, which one?
  2. If this was version related, can you give it a try in 4.9 Preview with a copy of your project?
  3. Is this something that only occurs in your current project or can it be reproduced in a fresh project with relative ease?
  4. If it can be reproduced; How would you go about doing this?
  5. If it is a project-specific issue, would it be possible to have a copy of your project?

Hi ,

We haven’t heard from you in a while. Are you still experiencing this issue? I’ll be marking this issue as resolved for tracking purposes in the meantime. If you do require further assistance however, please let me know by commenting and the post will reopen.

Hi ,

sorry, we’re very busy right now and since we’re a small team, it’s not possible for us to spare time to help in debugging this. We’ve talked with another team as well, they’re also having the same problem with 4.8.3. So we’ve decided that it’s better to do it painfully (by creating a class and manually adding all the possible items we want to spawn in game) than wait for the bug to be fixed.

But to answer your question

  1. It started with 4.8.3
  2. Sorry, no time to check right now.
  3. Another team has the same problem, a totally different project.
  4. I really don’t know. We implemented a system that calls LoadObject during 4.8.2, it worked because we play tested it quite often. After 4.8.3 update, it started crashing,
  5. I think it’s not project specific, another team with a different project has exactly the same problem.

Also, if in editor we first load the problematic blueprint by double clicking it in asset browser, it doesn’t crash when we run play in editor.

Here’s the code we use, maybe we’re using it wrongly ?

TSubclassOf<AItem> UFuncLib::GetRandomItemAtPath(const FString& Path)
{
	UObjectLibrary* ObjectLibrary = UObjectLibrary::CreateLibrary(AItem::StaticClass(), true, GIsEditor);
	ObjectLibrary->AddToRoot();
	if (ObjectLibrary->LoadBlueprintAssetDataFromPath(Path) > 0)
	{
		TArray<FAssetData> OutAssetData;
		ObjectLibrary->GetAssetDataList(OutAssetData);
		int32 RandomIndex = FMath::RandRange(0, OutAssetData.Num() - 1);
		const FString* ClassName = OutAssetData[RandomIndex].TagsAndValues.Find("GeneratedClass");
		FString ObjectPath = *ClassName;
		UObject* Asset = FindObject<UObject>(nullptr, *ObjectPath);
		if (!Asset)
		{
			Asset = LoadObject<UObject>(nullptr, *ObjectPath);
		}
		if (Asset)
		{
			TSubclassOf<AItem> ItemClass = Cast<UClass>(Asset);
			return ItemClass;
		}
	}
	return nullptr;
}

Hello ,

Unfortunately, I’m having issues reproducing the crash which prevents me from doing anything in the form of reporting it in our database. Despite the issue not being project specific, would it be possible to get a copy of your project for testing purposes? If you wish to keep it private, you can send it to me through a private message on the forums. My username is .

I believe this would be the best way to go about this as it will help make up for the lack of time you have to assist with the issue.

Hi ,

We updated to 4.9 and gave it a go for a couple of days before reporting in. Good news is that we haven’t experienced any crashes from this problem, but there’s a warning on the output log that says

LogLinker:Warning: CreateExport: Failed to load Parent for Function /Game/Blueprints/BlablaClass.BlablaClass_C:UserConstructionScript; removing parent information, but keeping function

We’ve only seen this warning after 4.9 update (thank you for spitting out more information on warnings in other places as well), so upon closer inspection, the construction script of all problematic blueprints were calling a parent construction script, which is non-existence. After removing the calls, the warnings disappear, I’m betting this was the problem.

Thank you!