언리얼 프로그래밍 기초-변수

후이재·2021년 1월 31일
0

타입 이름 규칙

  • 언리얼은 모든 타입에 Prefix가 사용된다.
  • U: UObject상속받은 클래스(UObject는 UE4 일반적인 클래스들의 최상위 클래스)
    ex) UTexture
  • A: AActor 상속받은 클래스(AActor은 레벨에 배치, 생성되어 위치정보를 갖는 게임플레이어의 기본요소)
    ex) AGameMode(게임 플레이의 시작 포인트)
  • F: 그 이외의 모든 클래스와 struct
    ex)FName, FVector, FString
  • T: 템플릿
    ex) TArray, TMap
  • I: 인터페이스 클래스
    ex) ITransaction
  • E: Enum 타입
    ex) ESelectionMode
  • b: Boolean 변수
    ex) bEnabled
  • 언리얼에서 모든 것은 Pascal Case 사용(단어의 첫자는 대문자)

C++ 11 지원

  • Auto 키워드
for(auto It = MyMap.Createlterator();It;++It)
{
	UE_LOG(LogCategory, Log, TEXT("Key:%s, Value: %d"), It.Key(), *It.Value());
}
  • Ranged For Loops
for(TPair<FString, int32>& Kvp:MyMap)
{
	UE_LOG(LogCategory, Log, TEXT("Key: %s, VlueL: %d"), Kvp.Key, *Kvp.Value);
}
  • Lambdas 함수
AnotherArray.Sort((const Thing& Lhs, const Thing& Rhs){return Lhs.GetName()>Rhs.GetName();});

언리얼 오브젝트

  • 변수 에디터에 표시
UPROPERTY(EditAnywhere)
int32 TotalDamage;

UPROPERTY(EditAnywhere, Category="Damage") // Property의 Category를 지정할 수 있음
int32 TotalDamage;

UPROPERTY(EditAnywhrer, BlueprintReadWrite, Category = "Damage")
int32 TotalDamage; // BP에서 사용가능한 변수를 만들 수 있다.
profile
공부를 위한 벨로그

0개의 댓글