Packacing Failure UE5

I’m at the end of this lecture and i get a failure when trying to package, it’s something with the ReplicationComponent; I guess that NeedInitialization but i tried adding the Initialize method to the component but didn’t work

Error        PackagingResults          === Handled ensure: ===
Error        PackagingResults          Ensure condition failed: !NeedsInitialization() [File:D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\Components\ActorComponent.cpp] [Line: 2045]
Error        PackagingResults          SetIsReplicatedByDefault is preferred during Component Construction.
Error        PackagingResults          Stack:
Error        PackagingResults          [Callstack] 0x00007ffce2264b5d UnrealEditor-Engine.dll!UnknownFunction []
Error        PackagingResults          [Callstack] 0x00007ffcb74a8a6a UnrealEditor-MTD.dll!UCarReplicationComponent::UCarReplicationComponent() [E:\UnrealProjects\MTD\Source\MTD\Components\CarReplicationComponent.cpp:14]
Error        PackagingResults          [Callstack] 0x00007ffce5dfc44d UnrealEditor-CoreUObject.dll!UnknownFunction []
Error        PackagingResults          [Callstack] 0x00007ffce5c50ebe UnrealEditor-CoreUObject.dll!UnknownFunction []
Error        PackagingResults          [Callstack] 0x00007ffce608ec14 UnrealEditor-CoreUObject.dll!UnknownFunction []
Error        PackagingResults          [Callstack] 0x00007ffce5f62f2f UnrealEditor-CoreUObject.dll!UnknownFunction []
Error        PackagingResults          [Callstack] 0x00007ffcb74a2f9c UnrealEditor-MTD.dll!ACarBase::ACarBase() [E:\UnrealProjects\MTD\Source\MTD\Actors\Cars\CarBase.cpp:18]
Error        PackagingResults          [Callstack] 0x00007ffce5dfc44d UnrealEditor-CoreUObject.dll!UnknownFunction []
Error        PackagingResults          [Callstack] 0x00007ffce60d04dd UnrealEditor-CoreUObject.dll!UnknownFunction []
Error        PackagingResults          [Callstack] 0x00007ffce60b030b UnrealEditor-CoreUObject.dll!UnknownFunction []
Error        PackagingResults          [Callstack] 0x00007ffce5f682a5 UnrealEditor-CoreUObject.dll!UnknownFunction []
Error        PackagingResults          [Callstack] 0x00007ffce688a5c2 UnrealEditor-Core.dll!UnknownFunction []
Error        PackagingResults          [Callstack] 0x00007ffce68ae937 UnrealEditor-Core.dll!UnknownFunction []
Error        PackagingResults          [Callstack] 0x00007ffd216faaf6 UnrealEditor-Projects.dll!UnknownFunction []
Error        PackagingResults          [Callstack] 0x00007ffd216fae31 UnrealEditor-Projects.dll!UnknownFunction []
Error        PackagingResults          [Callstack] 0x00007ff6310e53cb UnrealEditor-Cmd.exe!UnknownFunction []
Error        PackagingResults          [Callstack] 0x00007ff6310e866e UnrealEditor-Cmd.exe!UnknownFunction []
Error        PackagingResults          [Callstack] 0x00007ff6310e0bbd UnrealEditor-Cmd.exe!UnknownFunction []
Error        PackagingResults          [Callstack] 0x00007ff6310e0e8a UnrealEditor-Cmd.exe!UnknownFunction []
Error        PackagingResults          [Callstack] 0x00007ff6310e3c4d UnrealEditor-Cmd.exe!UnknownFunction []
Error        PackagingResults          [Callstack] 0x00007ff6310f5564 UnrealEditor-Cmd.exe!UnknownFunction []
Error        PackagingResults          [Callstack] 0x00007ff6310f788a UnrealEditor-Cmd.exe!UnknownFunction []
Error        PackagingResults          [Callstack] 0x00007ffd93507034 KERNEL32.DLL!UnknownFunction []
Error        PackagingResults          [Callstack] 0x00007ffd949a2651 ntdll.dll!UnknownFunction []
Error        PackagingResults          end: stack for UAT```

CarReplicationComponent.cpp line from 7 trough 16:

// Sets default values for this component's properties
UCarReplicationComponent::UCarReplicationComponent()
{
	
	// Set this component to be initialized when the game starts, and to be ticked every frame.  You can turn these features
	// off to improve performance if you don't need them.
	PrimaryComponentTick.bCanEverTick = true;
	
	// ...
}

CarBase.cpp  line 8-19:
ACarBase::ACarBase()
{
 	// Set this pawn to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;
	bReplicates = true;
	
	ReplicationComponent = CreateDefaultSubobject<UCarReplicationComponent>("Replication Component",false);
	
	MovementComponent = CreateDefaultSubobject<UCarMovementComponent>("Movement Component",false);
	ReplicationComponent->SetIsReplicated(true);
	
}
1 Like

Have you got live coding turned on? if so, turn it off and close the editor.
Delete the binaries folder and then launch the project again.

The error is pointing to your replication component so that to me indicates there’s a issue with the code. Sometimes live coding doesn’t report errors correctly and is quite unstable.

Give this a try and you may find there’s a compile error. The Package Compiles in a similar manner to a build when live coding is off so I’d expect to see the same issues.

Let me know how you get on.

DId exactly as you said and it packaged just fine, thanks.

I’m trying to solve another issue, maybe you can point me in the right direction if you got time, i’m now making the Main menu host button create/host a map where the car should be used, but when i spawn there after ServerTravel i cannot control my car

Shows a full screen and no car???

possibly not enough network spawn points. This is covered somewhere.

Shows a car but i cannot move it, i guess something input related

I would check your input event handlers. Also, it could point to an issue with the replication component which might prevent movement if not set up correctly.

works on client and not on server

That doesn’t matter so much. All moves have to be replicated to the server. Add some log messages to be sure to see where the code is running. It is probably related to certain IF statements that check where the code is running.