I wanted to create a custom actor with a couple components on it. Everything works fine, I can place it in level close editor open up again and its fine except I get an import error for each of the components.
Before creating this post I tried creating a custom actor with but a single component in a new fresh empty project and the same thing happened. I was wondering if I’m missing something although in the original component I creating a simply duplicated some stuff from the ACharacter so there shouldn’t have been a problem.
- Create new empty c++ project and create a custom actor like the one below.
- Place actor in level and save it.
- Reload level and the error pops up.
With the actor below I get the error: “LoadErrors:Error: Error /Game/Untitled : Failed import for CapsuleComponent /Game/NewBlueprint.Default__NewBlueprint_C:CapsuleComponent”
Where “Untitled” is the level name and “NewBlueprint” is the actor bp name.
The error also seems to be accompanied by a warning: “LogText:Warning: Failed to parse argument “ImportClass” as a number (using “0” as a fallback). Please check your format string for errors: “: Failed import for {ImportClass}”.”
Note: Just creating the component and not assigning it as the RootComponent will give the error
Header file:
#pragma once
#include "TestActor.generated.h"
UCLASS(Blueprintable, BlueprintType)
class MYPROJECT3_API ATestActor : public AActor
{
GENERATED_BODY()
public:
ATestActor(const FObjectInitializer& ObjectInitializer);
UPROPERTY(Category = "Default", EditAnywhere)
class UCapsuleComponent* CapsuleComponent;
};
Source file:
#include "MyProject3.h"
ATestActor::ATestActor(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
CapsuleComponent = CreateDefaultSubobject<UCapsuleComponent>("CapsuleComponent");
RootComponent = CapsuleComponent;
}