• 카테고리

    질문 & 답변
  • 세부 분야

    게임 프로그래밍

  • 해결 여부

    미해결

6강 마지막 내용 부분 크래쉬 오류

24.04.15 16:54 작성 조회수 65

0

스크린샷 2024-04-15 165048.png스크린샷 2024-04-15 165101.pngrtbase

ucrtbase

ucrtbase

ucrtbase

UnrealEditor_Core

UnrealEditor_ObjectReflection!DispatchCheckVerify<void,<lambda_cf21b4e29d6226a2d775ca19e16af934>,FLogCategoryLogTemp,wchar_t [16]>() [C:\Program Files\Epic Games\UE_5.1\Engine\Source\Runtime\Core\Public\Misc\AssertionMacros.h:171]

UnrealEditor_ObjectReflection!UStudent::DoLesson() [C:\UnrealProject\ObjectReflection\Source\ObjectReflection\Student.cpp:18]

UnrealEditor_ObjectReflection!UMyGameInstance::Init() [C:\UnrealProject\ObjectReflection\Source\ObjectReflection\MyGameInstance.cpp:56]

UnrealEditor_Engine

UnrealEditor_UnrealEd

UnrealEditor_UnrealEd

UnrealEditor_UnrealEd

UnrealEditor_UnrealEd

UnrealEditor_UnrealEd

UnrealEditor_UnrealEd

UnrealEditor_UnrealEd

UnrealEditor_UnrealEd

UnrealEditor

UnrealEditor

UnrealEditor

UnrealEditor

UnrealEditor

UnrealEditor

kernel32

ntdll



6강 보면서 하는데 선생님하신것처럼

 

Student->DoLesson();이후부터 저 코드를 주석을 처리하든 말든 무조건 실행시 언리얼엔진이 크래쉬를 일으킵니다 내용 대로 Student 클래스랑 init도 다시 확인했는데 정상이고요

 

따로 문제가 있을까요?

 


#include "MyGameInstance.h"
#include "Student.h"
#include "Teacher.h"

UMyGameInstance::UMyGameInstance()
{
    
       SchoolName = TEXT("School");
    
}

void UMyGameInstance::Init()
{
    Super::Init();

    UE_LOG(LogTemp, Log , TEXT("=============================="));
    UClass* ClassRuntime = GetClass();
    UClass* ClassCompile = UMyGameInstance::StaticClass();
    check(ClassRuntime==ClassCompile);
    
    UE_LOG(LogTemp,Log,TEXT("School Class Name :  %s"), *ClassRuntime->GetName());

    SchoolName = TEXT("Normal School");
    UE_LOG(LogTemp,Log,TEXT("School Name : %s"), *SchoolName);
    UE_LOG(LogTemp,Log,TEXT("School Name Nomal : %s"),*GetClass()->GetDefaultObject<UMyGameInstance>()->SchoolName)
    
    
    UE_LOG(LogTemp, Log , TEXT("=============================="));

    UStudent* Student = NewObject<UStudent>();
    UTeacher* Teacher = NewObject<UTeacher>();

    Student->SetName(TEXT("Student 1"));
    UE_LOG(LogTemp, Log , TEXT("New Student Name %s"),*Student->GetName());

    FString CurrentTeacherName;
    FString NewTeacherName(TEXT("QWER"));
    FProperty* NameProp = UTeacher::StaticClass()->FindPropertyByName(TEXT("Name"));

    if (NameProp)
    {
       NameProp->GetValue_InContainer(Teacher,&CurrentTeacherName);
       UE_LOG(LogTemp,Log , TEXT("Current Teacher Name %s "),*CurrentTeacherName);

       NameProp->SetValue_InContainer(Teacher , &NewTeacherName);
       UE_LOG(LogTemp,Log , TEXT("New Teacher Name %s "),*Teacher->GetName());

    }

    UE_LOG(LogTemp, Log , TEXT("=============================="));

    Student->DoLesson();
    UFunction* DoLessonFunnc = Teacher->GetClass()->FindFunctionByName(TEXT("DoLesson"));
    if (DoLessonFunnc)
    {
       Teacher->ProcessEvent(DoLessonFunnc,nullptr);
    }
}

답변 1

답변을 작성해보세요.

0

우선 디버깅 기호를 추가로 설치해보셨을까요?
로그 찍는 부분에서 문제가 있는 듯 한데, 하나씩 실행해보는 수 밖에요.

image