// Fill out your copyright notice in the Description page of Project Settings.
#include "HelloGameModeBase.h"
#include"MyObject.h"
#include "MiddleStudent.h"
#include "UObject/UObjectHash.h"
#include "UObject/UObjectIterator.h"
AHelloGameModeBase::AHelloGameModeBase()
{
UE_LOG(LogTemp, Warning, TEXT("ddddddddddddddddddddddddd"));
//1.1 创建MyObject对象
UMyObject* MyObject = NewObject<UMyObject>();
//2.1 得到MyObject对象的UClass,并且得到类的名称
UClass* ObjectClass = MyObject->GetClass();
FString ClassName = ObjectClass->GetName();
//1.2 通过对象得到对象的名称
FString ObjectName = MyObject->GetName();
UE_LOG(LogTemp, Warning, TEXT("MyObjectname..%s"),*ObjectName);
UE_LOG(LogTemp, Warning, TEXT("classname..%s"),*ClassName);
//2.2 获取父类的名称
UMiddleStudent* middleStudent = NewObject<UMiddleStudent>();
UClass* parentClass = middleStudent->GetClass()->GetSuperClass();
FString parentClassName = parentClass->GetName();
UE_LOG
Ue4反射使用
最新推荐文章于 2024-02-29 10:12:04 发布