언리얼4 C++ 액터 수 가져오기(Get Actors)
Intro
- 액터(몬스터) 수 가져오기
GetAllActorsWithTag
GetAllActorsWithTag를 사용하여 Monster 태그를 가진 액터들을 배열에 저장한다음 Int형 변수 RemainZombie에 Actors.Num()을 통해 액터 숫자를 저장시킨다.
void AFPSGameMode::BeginPlay()
{
Super::BeginPlay();
TArray<AActor*> Actors;
UGameplayStatics::GetAllActorsWithTag(GetWorld(), TEXT("Monster"), Actors);
RemainZombie = Actors.Num();
}
UI에 표시
UI에 RemainZombie 변수를 출력

실행결과

댓글남기기