[RESOLVED] L149 "BluePrintReady" done - now got UE Error; Failed import for TankMovementComponent

Edit: This issue resolved itself after redoing the component architecture (I believe the next lesson already), although I cannot point exactly to what was the cause. Leaving the post as-is in case someone else runs into the same issue.


I completed lesson 149 (yay me!) and compared to @ben’s solution afterwards. My solution included making the Movement Component tick like in the aiming-component - with the following implementation:
UTankMovementComponent::UTankMovementComponent() { // Set this component to be initialized when the game starts, and to tick // every frame. Turn these features off to improve performance if not needed bWantsBeginPlay = true; PrimaryComponentTick.bCanEverTick = false; }

Following Ben’s solution, I decided to remove the tick, only to get some fairly nasty error logs (sorry, didn’t keep the output) about looking for something in an unavailable class (if memory serves me right). After googling the error, I ended up deleting the .vs, Binaries, Intermediate and Saved folders, VS solution and .db files, then rebuilding the project and and VS project files - which got rid of them.

However, now I have the following error instead - and rebuilding the project doesn’t help:
LoadErrors:Error: Error /Game/_Levels/BattleGround : Failed import for TankMovementComponent /Game/Tank/Tank_BP.Default__Tank_BP_C:Movement Component

I think it is related to this warning (which is new, AFAIK):
LogTextFormatter: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}".

The closest I found when looking online was that it is something in the Intermediate folder; however, removing that and rebuilding doesn’t work. The game seems to be working as expected, though - so the gamepad stick logs as it is supposed to. I’m currently on Engine v. 4.13.1, and these are my implementations;

TankMovementComponent.h
#pragma once

#include "GameFramework/NavMovementComponent.h"
#include "TankMovementComponent.generated.h"

/**
 * Fly-by-wire movement API
 */
UCLASS()
class BATTLETANK_API UTankMovementComponent : public UNavMovementComponent
{
    GENERATED_BODY()

public:
    UFUNCTION(BlueprintCallable, Category = Input)
    void IntendMoveForward(float Throw);

};
TankMovementComponent.cpp
#include "BattleTank.h"
#include "TankMovementComponent.h"

void UTankMovementComponent::IntendMoveForward(float Throw)
{
    UE_LOG(LogTemp, Warning, TEXT("Intend move forward: %f"), Throw);
}
tank.h (relevant sections only)
#pragma once

#include "GameFramework/Pawn.h"
#include "Tank.generated.h" // Put new includes above this

// forward declarations
class UTankBarrel;
class UTankAimingComponent;
class UTankMovementComponent;
class AProjectile;

UCLASS()
class BATTLETANK_API ATank : public APawn
{
    GENERATED_BODY()

public:

    UPROPERTY(BlueprintReadOnly)
    UTankMovementComponent* TankMovementComponent = nullptr;

[...]

};
tank.cpp (relevant sections only)
#include "BattleTank.h"
#include "TankBarrel.h"
#include "Projectile.h"
#include "TankAimingComponent.h"
#include "TankMovementComponent.h"
#include "Tank.h"

// Sets default values
ATank::ATank()
{
     // Set this pawn to call Tick() every frame. 
    // You can turn this off to improve performance if you don't need it.
    PrimaryActorTick.bCanEverTick = false;

    // no need to protect pointers as added on construction
    TankAimingComponent = 
        CreateDefaultSubobject<UTankAimingComponent>(FName("Aiming Component"));

    TankMovementComponent =
        CreateDefaultSubobject<UTankMovementComponent>(FName("Movement Component"));
}
And this is what my tank blueprint input setup looks like (screenshot)

Oh, and if anyone has any idea what may cause this warning (it’s been there for as long as I can remember now, so possibly not remotely related to the error this thread is about), please feel free to give me a heads up:
LogUObjectGlobals:Warning: Failed to find object 'Class None.'

Privacy & Terms