인프런 커뮤니티 질문&답변
6강 마지막 내용 부분 크래쉬 오류
작성
·
270
0


rtbase
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);
    }
}






