TBasePlayerControllerIterator

PlayerControllerIterators This is the safest, most efficient way to iterate over player controllers.

Windows
MacOS
Linux

References

Module

Engine

Header

/Engine/Source/Runtime/Engine/Public/UnrealEngine.h

Include

#include "UnrealEngine.h"

Syntax

template<class T, bool LocalOnly>
class TBasePlayerControllerIterator

Remarks

PlayerControllerIterators This is the safest, most efficient way to iterate over player controllers.

Examples:

for (TPlayerControllerIterator<AQAPlayerController>::LocalOnly It(GetWorld()); It; ++It) { // PC is a locally controlled AQAPlayerController. AQAPlayerController * PC = *It;

// This PC will always be locally controlled! check(PC->IsLocalController(); }

for (TPlayerControllerIterator<AQAPlayerController>::ServerAll It(GetWorld()); It; ++It) { // PC is a AQAPlayerController. It may local or remotely controlled. AQAPlayerController * PC = *It;

// This can only be done on the server! // Only the server has player controllers for everyone! check(GetWorld()->GetNetMode() != NM_Client); }

Variables

Name Description

Protected variable

T *

 

Current

Protected variable

FConstPlayerCon...

 

Iter

Constructors

Name Description

Public function

TBasePlayerControllerIterator

(
    UWorld* InWorld
)

Functions

Name Description

Protected function

void

 

AdvanceCurrent()

Protected function

void

 

Next()

Operators

Name Description

Public function Const

 

operator bool()

Public function Const

T *

 

operator*()

Public function

void

 

operator++()

Public function Const

T *

 

operator->()

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss