* 정의

 

Actor는 레벨에 배치될 수 있는 Camera, StaticMesh, PlayerStartLocation과 같은 객체를 의미한다. Actor는 이동, 회전, 스케일링을 지원하며 게임플레이 코드를 통해 생성되거나 파괴될 수 있다. 이러한 데이터는 Actor의 RootComponent에 존재한다. AActor 클래스는 모든 Actor들의 기본 클래스이다.

 

 

* 동작 방식

 

- 생성

 

특수화된 템플릿 버전의 SpawnActor()를 통해서 생성할 수 있다.

 

정확하게는 UWorld::SpawnActor() 함수를 통해 이루어지며 간단한 예시는 다음과 같다.

AMyActor* actor1 = (AMyActor*) GetWorld()->SpawnActor(AMyActor::StaticClass(), NAME_None, &currentLocation);

 

자세한 사용 방법은 다음 문서에서 확인할 수 있다.

https://docs.unrealengine.com/4.27/en-US/ProgrammingAndScripting/ProgrammingWithCPP/UnrealArchitecture/Actors/Spawning/

 

Spawning Actors

Methods of creating new instances of Actors in gameplay code.

docs.unrealengine.com

 

 

- 삭제

 

World Object는 Actor의 참조 리스트를 가지고 있기 때문에 일반적으로 가비지 컬렉트되지 않는다. Destroy() 라는 함수를 통해 명시적으로 삭제 가능하다. 이 함수를 Actor를 레벨에서 삭제하고 pending kill로 마킹함으로써 다음 가비지 컬렉션에 의해 처리될 수 있다.

 

 

- Component

 

https://create-new-worlds.tistory.com/137

 

[UnrealEngine] ActorComponent

* 정의 Component는 특별한 타입의 Object로 서브오브젝트로서 Actor에 부착될 수 있다. Actor 측면에서는 Component라는 특별한 타입의 Object들을 담고 있는 컨테이너라고 볼 수 있다. 여러 타입의 Component

create-new-worlds.tistory.com

 

 

- Tick

 

https://create-new-worlds.tistory.com/142

 

[UnrealEngine] Tick

* 정의 Tick은 특정 코드를 특정 시간 간격(매 프레임, 특정 간격 등) 마다 수행하는 것을 말하며, Actor는 Tick(), ActorComponent는 TickComponent()라는 함수를 통해 기본적으로 수행될 수 있다. Tick 순서(Act..

create-new-worlds.tistory.com

 

+ Recent posts