March 2019
Intermediate to advanced
708 pages
17h 9m
English
We create an array of pointers to MyInterface implementations.
Inside BeginPlay, we use TActorIterator<AActor> to get all of the Actor instances in our level.
TActorIterator has the following constructor:
explicit TActorIterator( UWorld* InWorld, TSubclassOf<ActorType>InClass = ActorType::StaticClass() ) : Super(InWorld, InClass )
TActorIterator expects a world to act on, as well as a UClass instance to specify what types of Actor we are interested in.
ActorIterator is an iterator like the STL iterator type. This means that we can write a for loop in the following form:
for (iterator-constructor;iterator;++iterator)
Inside the loop, we dereference the iterator to get an Actor pointer.
We then attempt to cast it to our interface; ...
Read now
Unlock full access