zworld-em/Source/zworld/CrashActor.cpp
2025-05-17 18:56:46 +08:00

38 lines
830 B
C++

// Fill out your copyright notice in the Description page of Project Settings.
#include "CrashActor.h"
DEFINE_LOG_CATEGORY(LogCrash);
// Sets default values
ACrashActor::ACrashActor()
{
// 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;
}
// Called when the game starts or when spawned
void ACrashActor::BeginPlay()
{
Super::BeginPlay();
}
void TestCrash(int CrashFrame) {
auto FN = [=]() {
int* ptr = nullptr;
*ptr = CrashFrame + 6;
};
FN();
}
// Called every frame
void ACrashActor::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
CrashFrame = 200;
if (Frame++ >= CrashFrame) {
if (Frame == CrashFrame + 100) {
UE_LOG(LogTemp, Error, TEXT("ACrashActor:BeforeCrash"));
TestCrash(CrashFrame);
}
}
}