When creating and declaring a Spline Component in code, placing an instance of a blueprint derived from that class in the level causes a failed import message to appear upon restarting the level.
1. Open the editor
2. Create a new C++ Actor class
3. Modify your .h code to look like this:
#pragma once #include "GameFramework/Actor.h" #include "MyActor.generated.h" class USplineComponent; UCLASS() class SPLINETEST_API AMyActor : public AActor { GENERATED_BODY() public: // Sets default values for this actor's properties AMyActor(); // Called when the game starts or when spawned virtual void BeginPlay() override; // Called every frame virtual void Tick( float DeltaSeconds ) override; USplineComponent* SplineComponent; };
4. Modify your .cpp code to look like this:
#include "SplineTest.h" #include "Runtime/Engine/Classes/Components/SplineComponent.h" #include "MyActor.h" // Sets default values AMyActor::AMyActor() { // Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it. PrimaryActorTick.bCanEverTick = true; SplineComponent = CreateDefaultSubobject<USplineComponent>(TEXT("Path Cycle")); check(SplineComponent != nullptr); }
5. Compile
6. Open the editor again
7. Derive a blueprint from your Actor class
8. Drop the blueprint into the level
9. Save All and restart the project
Result: Notice you get an Error /Game/FirstPersonCPP/Maps/FirstPersonExampleMap : Failed import for SplineComponent /Game/MyMyActor.Default__MyMyActor_C:Path Cycle
Expected: No error would occur
Head over to the existing Questions & Answers thread and let us know what's up.
9 |
Component | UE - Gameplay - Blueprint |
---|---|
Affects Versions | 4.11, 4.12 |
Target Fix | 4.14 |
Fix Commit | 3152086 |
---|---|
Main Commit | 3153517 |
Created | Jul 5, 2016 |
---|---|
Resolved | Oct 5, 2016 |
Updated | Apr 27, 2018 |