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.
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.
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?
Make a blank new project (no starter content needed)
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"
// 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
In this folder Stats, create 2 BP childs of BaseStat and name it Stat1 and Stat2
Edit MyCharacter, add the StatBlock Component (should throw no errors til now)
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
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
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.
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.
Sadly your project didn’t work again. 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?
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.
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)
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.
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.