I am facing a issue un UE4,7.1. I created a simple class derived from AActor and attaching a USplineComponent to it.
Here is my class:
// Fill out your copyright notice in the Description page of Project Settings.
//MySplineGenerator.cpp
#include "test.h"
#include "MySplineGenerator.h"
// Sets default values
AMySplineGenerator::AMySplineGenerator()
{
// 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;
//create spline component
splineComponent = CreateDefaultSubobject<USplineComponent>(FName(TEXT("MySplineComponent")));
if (splineComponent)
{
/*if(GEngine)
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Got spline component"));*/
}
}
// Called when the game starts or when spawned
void AMySplineGenerator::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void AMySplineGenerator::Tick( float DeltaTime )
{
Super::Tick( DeltaTime );
}
void AMySplineGenerator::EndPlay(const EEndPlayReason::Type EndPlayReason){
if (splineComponent)
splineComponent->DestroyComponent();
Super::EndPlay(EndPlayReason);
}
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "GameFramework/Actor.h"
#include "Runtime/Engine/Classes/Components/SplineComponent.h"
#include "MySplineGenerator.generated.h"
UCLASS(Blueprintable)
class TEST_API AMySplineGenerator : public AActor
{
GENERATED_BODY()
public:
//Spline generated component
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = LevelElement)
USplineComponent* splineComponent;
// Sets default values for this actor's properties
AMySplineGenerator();
// Called when the game starts or when spawned
virtual void BeginPlay() override;
// Called every frame
virtual void Tick( float DeltaSeconds ) override;
//End play
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
};
Now whenever I am creating a blueprint using this class as parent. I am hitting a breakpoint while placing that blueprint in my scene. I have not added any functionality in the blueprint.
The breakpoint is in file : Unreal Engine\4.7\Engine\Source\Editor\Kismet\Private\SSCSEditor.cpp
and at this point : **ensure(!InSceneComponent->HasAnyFlags(RF_PendingKill));**
I’m not sure what is missing in my code. Any help would be great.
Thanks in advance.