I need some help to understand what I'm doing wrong here x_x
Here's my step:
1) create a new C++ project with starting content, drop a door in the scene.
2)Add a C++ component to the door called OpenDoor
3)add a variable in the .h and initialize it in the .cpp (code below)
When I compile this, the editor crash and any future attempt to open the project won't succede. What mistake did I made? Furthermore, if said mistake is made, is the project lost forever or there is a way to restore it? x_x Cause if wathever silly mistake I've made, if it's all it takes to corrupt and lose an entire project, then I'm done with Unreal Editor... x_x
OpenDoor.h:
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "OpenDoor.generated.h"
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class BUILDINGESCAPE_API UOpenDoor : public UActorComponent
{
GENERATED_BODY()
public:
// Sets default values for this component's properties
UOpenDoor();
protected:
// Called when the game starts
virtual void BeginPlay() override;
public:
// Called every frame
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
private:
float DoorYaw;
};
OpenDoor.cpp:
// Fill out your copyright notice in the Description page of Project Settings.
#include "OpenDoor.h"
#include "GameFramework/Actor.h"
// Sets default values for this component's properties
UOpenDoor::UOpenDoor()
:DoorYaw{GetOwner()->GetActorRotation().Yaw}
{
// Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features
// off to improve performance if you don't need them.
PrimaryComponentTick.bCanEverTick = true;
// ...
}
// Called when the game starts
void UOpenDoor::BeginPlay()
{
Super::BeginPlay();
// ...
}
// Called every frame
void UOpenDoor::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
// ...
}
↧