Hi!
I’ve created movement class and now trying to use it.
class CONTENT_API UMoveMotor : public UMovementComponent
class CONTENT_API ASteper : public AActor
...
UPROPERTY(Category = Steper, VisibleAnywhere, BlueprintReadOnly)
TSubobjectPtr<UMoveMotor> m_Motor;
...
ASteper::ASteper(const class FPostConstructInitializeProperties& PCIP)
: Super(PCIP)
{
m_Motor = PCIP.CreateDefaultSubobject<UMoveMotor>(this, TEXT("ShipMoveComponent"));
if (!m_Motor)
GEngine->AddOnScreenDebugMessage(-1, 20.0f, FColor::Red, TEXT("No Moving motor were constructed!"));
PrimaryActorTick.bCanEverTick = true;
}
...
void ASteper::AddNewCoursePoint(FVector position)
{
if (m_Motor != NULL)
m_Motor->AddNewControlPoint(position);
else
GEngine->AddOnScreenDebugMessage(-1, 20.0f, FColor::Red, TEXT("No Moving motor"));
}
In ASteper constructor everything finy. But when I’m trying to call AddNewCoursePoint from parent Actor class (ASteper) it’s saying that m_Motor isn’t valid already.
Ticking of movement component keep going right.
What’s the problem? Why m_Motor became invalid?