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->()

Select Skin
Light
Dark

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback