Packaging error

Engine version is 4.11.2 from github with a small change from myself (which doesn’t find any appearance in this test project). While writing this, i download 4.12 binaries to try it with them, but i have a hunch that it is not solved by 4.12.

Getting a weird error while packaging a very small test project to check if my class setup would actually work.

Assertion failed: IsValidIndex(Index) && ChunkIndex < NumChunks && Index < MaxTotalElements [File:C:\GitHub\UE4.11\Engine\Source\Runtime\Core\Public\UObject\NameTypes.h] [Line: 314]

First the Cook log: [Cooklog][1]
And the project itself (i hope i got all necessary files): [Projectfiles][2]

It works flawless in edit or launch, but packaging always errors out.

Any help is very much appreciated.

92897-cook-2016.06.01-20.18.45.txt (134 KB)
[2]: 92898-testproject3.zip (447 KB)

Additional info:
Error only occurs if i connect my subobject array to some blueprint stuff (doesn’t seem to bother what it’s connected to).
Since i dynamically fill my array in the constructor, there might be a flaw in the ‘blueprint to package’ code regarding arrays with subobjects.
No error whatsoever trying it in PIE/Launch.

Had the wrong title. It’s a packaging error/bug, not git source control

Same error message with 4.12 binaries

Hey Algorithman,

I can’t get your project to build on my computer, so I can’t open it. Could you provide me with full reproduction steps in order to walk through this crash myself?

Thanks!

Sorry for the late answer.

Sure.

  1. Make a blank new project (no starter content needed)
  2. Create 2 c++ classes BaseStat (UObject) and StatBlock (UActorComponent)

Source BaseStat.h:

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "Object.h"
#include "BaseStat.generated.h"


/**
*
*/
UCLASS(Blueprintable, BlueprintType, ClassGroup = (Custom), EditInlineNew, NonTransient, WithIn = StatBlock)
class TESTPROJECT3_API UBaseStat : public UObject
{
	GENERATED_BODY()
public:
	UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "StatDetail")
		float TestValue;
};

Source BaseStat.cpp:

// Fill out your copyright notice in the Description page of Project Settings.

#include "TestProject3.h"
#include "BaseStat.h"

Source StatBlock.h:

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "Components/ActorComponent.h"
#include "BaseStat.h"
#include "Array.h"
#include "StatBlock.generated.h"

UCLASS(Blueprintable, BlueprintType, ClassGroup = (Custom), meta = (BlueprintSpawnableComponent))
class TESTPROJECT3_API UStatBlock : public UActorComponent
{
	GENERATED_UCLASS_BODY()

public:


	// Called when the game starts
	virtual void BeginPlay() override;

	// Called every frame
	virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;


public:
	UPROPERTY(BlueprintReadWrite, Instanced, EditAnywhere, Category = "Stats")
		TArray<UBaseStat*> StatList;

private:
	static TArray<UClass*> StatClasses;
	void IterateClasses();
};

Sorry, i can’t add the source for StatBlock.cpp.
Comment button just doesnt work
Says 34 characters left, but button is without any function.
i’ll try as answer

Source StatBlock.cpp:

#include "TestProject3.h"
#include "StatBlock.h"
#include "AssetRegistryModule.h"


TArray<UClass*> UStatBlock::StatClasses;

UStatBlock::UStatBlock(const FObjectInitializer& ObjectInitializer)
{
	bWantsBeginPlay = true;
	PrimaryComponentTick.bCanEverTick = true;
	IterateClasses();

	for (UClass* clazz : StatClasses)
	{
		FString fName = clazz->GetName();
		FName dso = FName(*fName);
		StatList.Add(Cast<UBaseStat>(ObjectInitializer.CreateDefaultSubobject(this, dso, clazz, clazz, true, false, false)));
	}
}

void UStatBlock::BeginPlay()
{
	Super::BeginPlay();
}


void UStatBlock::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
	Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
}

void UStatBlock::IterateClasses()
{
	{
		FAssetRegistryModule* AssetRegistryModule = &FModuleManager::LoadModuleChecked<FAssetRegistryModule>(TEXT("AssetRegistry"));

		TArray<FAssetData> AssetData;
		FARFilter Filter;
		IAssetRegistry& AssetRegistry = AssetRegistryModule->Get();

		TArray<FString> PathsToScan;

		AssetRegistry.GetSubPaths(TEXT("/Game/Stats"), PathsToScan, true);
		AssetRegistry.ScanPathsSynchronous(PathsToScan, true);
		PathsToScan.Add(FString(TEXT("/Game/Stats")));

		for (FString path : PathsToScan)
		{
			AssetRegistry.GetAssetsByPath(FName(*path), AssetData);

			for (FAssetData fas : AssetData)
			{
				fas.GetAsset();
			}
		}
	}

	TArray<UObject*> ClassList;

	GetObjectsOfClass(UClass::StaticClass(), ClassList, true, EObjectFlags::RF_NoFlags);

	for (UObject* t : ClassList)
	{
		UClass* tt = dynamic_cast<UClass*>(t);

		if (tt->GetName().Find(TEXT("REINST_")) == INDEX_NONE && tt->GetName().Find(TEXT("SKEL_")) == INDEX_NONE)
		{
			if (tt->IsChildOf<UBaseStat>())
			{
				if (tt != UBaseStat::StaticClass())
				{
					StatClasses.AddUnique(tt);
				}
			}
		}
	}
}

Thats the setup.

Compile in the editor, should throw no errors.

The next steps:

  1. Create a BP MyCharacter class from Character.
  2. Create folder Stats in Content
  3. In this folder Stats, create 2 BP childs of BaseStat and name it Stat1 and Stat2
  4. Edit MyCharacter, add the StatBlock Component (should throw no errors til now)
  5. Click the StatBlock Component and edit the TestValue of Stat1 to whatever value.
    If you Package now, no error occurs.
    But if you go into MyCharacter and add some BP nodes to print the TestValue of the first element of the StatList array (StatBlock->StatList[0]->TestValue) and package again, the packaging stops with the aforementioned error message.

My guess is, that while packaging either the constructor of StatBlock is not run or the array is emptied by some BP mechanism. But thats for you folks to answer :slight_smile:

What i already tried:

  • adding the AssetRegistry to the uproject file as dependency (no effect at all)
  • adding Logging, but didn’t give me the right clue yet, what happens
  • build the child stats on c++ only (packaging works then, but i want to use BP’s too)
  • package with Blueprint nativize (i think it did throw another error, not sure)

Thing is, i do not want to define all classes beforehand (like in Ark, i find it very awful to do it that way).

Another thing: Editor crashes if you remove the StatBlock component from MyCharacter and then compile blueprint, but that could be a issue with having no destructor in StatBlock.

Tried everything with 4.11 from source and binaries 4.12.0 and 4.12.1

Thx

see the lengthy replies :slight_smile:

Algorithman,

Thank you for providing me all of the steps in detail. I went ahead and set up the project exactly like you stated. At the end, I set the TestValue to 56, compiled and saved without any errors. At that point, I decided to package and everything went successfully. I packaged for both Android ETC2 and Win 64. Then I added in for an event begin play for stat1 attached to a print string. I compiled and packaged for Android ETC2 and Win64 without any trouble.

Let me see a blueprint of MyCharacter to make sure I’ve attempted to package with the same type of blueprint as we want to resolve this critical error as quickly as possible.

Appreciate the report and assistance! :slight_smile:

Here you are.
Maybe it’s the Set in my BP which causes the error. I did write this report while being at work.
And i didn’t bother with anything else than Win64 yet.

For convenience: i packed up the project again (this time with the ‘File->Package->Zip up project’ menuitem): [TestProject][1]
Source might slightly differ, but not much. I tried a bunch of things in there, but in this state it will show the error while packaging.

Thx

Algorithman,

Sadly your project didn’t work again. :frowning: But I was able to verify that the reproduction steps you provided me do not cause any errors. I verified that the test value had a value entered in it as well.

  • Is this happening to you on any project that you work with?
  • Is this happening on 4.12.1?

Hello ,

It’s been happening for me on 4.11.5 from github source, 4.12.0 binary and 4.12.1 binary.
And only after i added the BP stuff in MyCharacter which i posted before. If i remove it, packaging runs just fine.
Also other projects package without errors.

Do you see the value counting up in PIE/packaged? (see my BP, it’s setting the value again)

As for the zipped project, what do i have to give you so you can open it?

Another thing: Editor crashes if you remove the StatBlock component from MyCharacter and then compile blueprint, but that could be a issue with having no destructor in StatBlock.

Does this happen to you too?
I don’t have a second pc here (strong enough for UE4 that is) to check on.

Hi ,

I know, why the projects won’t run.

If you extract the folder with the zip’s name (93887-testproject4) the generate project files part is generating defines which start with numbers, which result in many c++ errors. I renamed the folder back to testproject4 and did regenerate the project files and then it worked.

(just checked it here at work, packaging wont work)

Regards

Algorithman

After further review the crash of the editor, when compiling after deleting the StatBlock component, might be related to bug UE-31740.

Thanks for telling me to delete the beginning of the zip, that made it possible for me to open your project. I hadn’t ran into that specific issue before. :slight_smile:

I went ahead and put in a bug report for this issue which is: UE-31826. I referenced it back to UE-31740 just in case they are related since they sound so similar.

Thanks again for all of your assistance in getting this reported. I’ll let you know the outcome of this bug.

Me neither, i don’t normally zip my projects :slight_smile:

Thanks and have a nice weekend

Have a wonderful weekend yourself! :smiley:

Had same package error in 4.12.5 when using chunks, when dont use all ok. =
Any ideas how to solve it?