TIL_038: 리플렉션 시스템 등록

김펭귄·2025년 9월 22일

Today What I Learned (TIL)

목록 보기
38/139

오늘 학습 키워드

  • 리플렉션 시스템 등록

1. 리플렉션 시스템 등록

UCLASS() 매크로

  • UCLASS() 매크로는 클래스를 리플렉션 시스템에 등록해줌
#Item.h
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "Item.generated.h"	

UCLASS()
class SPARTPROJECT_API AItem : public AActor
{
	GENERATED_BODY()
    // ... //
};
  • 옵션 안 넣어주면 UCLASS(BluePrintable, BluePrintType)과 동일

  • 블루프린트에서 이 클래스를 상속 가능하고, 또한 블루프린트내에서 이 클래스를 변수로 참조가 가능한 형태로 등록

클래스 상속해 블루프린트 생성 가능다른 블루프린트 내에서 변수로서 객체 사용 가능
UCLASS(Blueprintable)					// 블루프린트에서 상속 가능
UCLASS(Blueprintable, BlueprintType)	// 상속가능, 변수로도 가능
UCLASS(NotBlueprintable)				// 상속불가능, 변수 사용도 불가능
UCLASS(BlueprintType)					// 상속 불가능, 변수 사용 가능
  • BluePrint 상속 옵션
    • Blueprintable: 블루프린트에서 상속 가능한 클래스로 설정
    • NotBlueprintable: 블루프린트에서 이 클래스를 상속할 수 없도록 설정
  • BluePrintType 옵션
    • BlueprintType: 블루프린트에서 변수나 참조로 사용할 수 있게 설정.
profile
반갑습니다

0개의 댓글