When a code class deriving from WheeledVehicleMovementComponent is created in a Vehicle Advanced template project, the user is required to include a constructor for the FWheelSetup struct in WheeledVehicleMovementComponent because the constructor is included in the .cpp file for that class instead of in the .h file.
#if WITH_VEHICLE
virtual void SetupVehicle() override;
#endif
#include "Vehicles/VehicleWheel.h" // ... UMyWheeledVehMoveComp::UMyWheeledVehMoveComp(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer) { WheelSetups.SetNum(4); } void UMyWheeledVehMoveComp::SetupVehicle() { for (int32 WheelIdx = 0; WheelIdx < WheelSetups.Num(); ++WheelIdx) { const FWheelSetup& WheelSetup = WheelSetups[WheelIdx]; if (WheelSetup.BoneName == NAME_None) { return; } } }
RESULT:
The build fails with an unresolved external error.
EXPECTED:
The build completes successfully.
WORKAROUND:
Adding the following code to the .cpp file of the new class allows the project to build successfully:
#if WITH_EDITOR && !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
FWheelSetup::FWheelSetup() : WheelClass(UVehicleWheel::StaticClass()), BoneName(NAME_None), AdditionalOffset(0.0f)
{
}
#endif
This is a copy of the constructor for the FWheelSetup struct in WheeledVehicleMovementComponent.
How does TextureRenderTarget2D get TArray<uint8> type data?
Why does the REMOVE method of map container remove elements have memory leaks?
What is the cause of the packaging error falling back to 'GameUserSettings' in ue5?
What is the difference between Camera and CineCamera?
UMG RichText not appear image when packaged
How do I set a material as a post-processing material?
How to delete some elements correctly when deleting an array loop?
Head over to the existing Questions & Answers thread and let us know what's up.
0 |
Component | UE - Simulation - Physics |
---|---|
Affects Versions | 4.5.1, 4.7 |
Fix Commit | 2366444 |
---|
Created | Nov 19, 2014 |
---|---|
Resolved | Nov 20, 2014 |
Updated | Apr 27, 2018 |