ULocalPlayer

Each player that is active on the current client has a LocalPlayer.

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

Engine

Header

/Engine/Source/Runtime/Engine/Classes/Engine/LocalPlayer.h

Include

#include "Engine/LocalPlayer.h"

Syntax

class ULocalPlayer : public UPlayer

Remarks

Each player that is active on the current client has a LocalPlayer. It stays active across maps There may be several spawned in the case of splitscreen/coop. There may be 0 spawned on servers.

Variables

Name Description

Public variable

TEnumAsByte< en...

 

AspectRatioAxisConstraint

How to constrain perspective viewport FOV

Public variable

uint32: 1

 

bSentSplitJoin

Set when we've sent a split join request

Public variable

FUniqueNetIdRep...

 

CachedUniqueNetId

The FUniqueNetId which this player is associated with.

Public variable

FVector

 

LastViewLocation

The location of the player's view the previous frame.

Public variable

FVector2D

 

Origin

The coordinates for the upper left corner of the master viewport subregion allocated to this player.

Public variable

TSubclassOf< cl...

 

PendingLevelPlayerControllerClass

The class of PlayerController to spawn for players logging in.

Public variable

FVector2D

 

Size

The size of the master viewport subregion allocated to this player. 0-1

Protected variable

FReply

 

SlateOperations

FReply used to defer some slate operations.

Public variable

UGameViewportCl...

 

ViewportClient

The master viewport containing this player's view.

Constructors

Name Description

Public function

ULocalPlayer

(
    const FObjectInitializer& ObjectIn...
)

Public function

ULocalPlayer

(
    FVTableHelper& Helper
)

DO NOT USE. This constructor is for internal usage only for hot-reload purposes.

Functions

Name Description

Public function Static

void

 

AddReferencedObjects

(
    UObject* InThis,
    FReferenceCollector& Collector
)

Public function Virtual

FSceneView &...

 

CalcSceneView

(
    FSceneViewFamily* ViewFamily,
    FVector& OutViewLocation,
    FRotator& OutViewRotation,
    FViewport* Viewport,
    FViewElementDrawer* ViewDrawer,
    EStereoscopicPass StereoPass
)

Calculate the view settings for drawing from this view actor

Public function

bool

 

CalcSceneViewInitOptions

(
    FSceneViewInitOptions& OutInitOpti...,
    FViewport* Viewport,
    FViewElementDrawer* ViewDrawer,
    EStereoscopicPass StereoPass
)

Calculate the view init settings for drawing from this view actor

Public function

void

 

CleanupViewState()

Clear cached view state.

Protected function

void

 

ExecMacro

(
    const TCHAR* Filename,
    FOutputDevice& Ar
)

Public function Const

FUniqueNetId...

 

GetCachedUniqueNetId()

Retrieves this player's unique net ID that was previously cached

Public function Const

int32

 

GetControllerId()

Returns the controller ID for the player

Public function Const

UGameInstanc...

 

GetGameInstance()

Get the game instance associated with this local player

Public function Virtual Const

FString

 

GetGameLoginOptions()

Retrieves any game-specific login options for this player if this function returns a non-empty string, the returned option or options be added passed in to the level loading and connection code.

Public function Virtual Const

FString

 

GetNickname()

Retrieves this player's name/tag from the online subsystem if this function returns a non-empty string, the returned name will replace the "Name" URL parameter passed around in the level loading and connection code, which normally comes from DefaultEngine.ini

Public function Static

bool

 

GetPixelBoundingBox

(
    const FSceneViewProjectionData& Pr...,
    const FBox& ActorBox,
    FVector2D& OutLowerLeft,
    FVector2D& OutUpperRight,
    const FVector2D* OptionalAllot...
)

This function will give you two points in Pixel Space that surround the World Space box.

Public function

bool

 

GetPixelBoundingBox

(
    const FBox& ActorBox,
    FVector2D& OutLowerLeft,
    FVector2D& OutUpperRight,
    const FVector2D* OptionalAllot...
)

This function will give you two points in Pixel Space that surround the World Space box.

Public function

bool

 

GetPixelPoint

(
    const FVector& InPoint,
    FVector2D& OutPoint,
    const FVector2D* OptionalAllot...
)

This function will give you a point in Pixel Space from a World Space position

Public function Static

bool

 

GetPixelPoint

(
    const FSceneViewProjectionData& Pr...,
    const FVector& InPoint,
    FVector2D& OutPoint,
    const FVector2D* OptionalAllot...
)

This function will give you a point in Pixel Space from a World Space position

Public function Const

FUniqueNetId...

 

GetPreferredUniqueNetId()

Retrieves the preferred unique net id.

Public function Virtual Const

bool

 

GetProjectionData

(
    FViewport* Viewport,
    EStereoscopicPass StereoPass,
    FSceneViewProjectionData& Projecti...
)

Helper function for deriving various bits of data needed for projection

Public function

FReply &

 

GetSlateOperations()

Getter for slate operations.

Public function Const

const FReply...

 

GetSlateOperations()

Public function

TSharedPtr< ...

 

GetSlateUser()

Get the SlateUser that this LocalPlayer corresponds to

Public function Const

TSharedPtr< ...

 

GetSlateUser()

Get the SlateUser that this LocalPlayer corresponds to

Public function Const

TSubsystemCl...

 

GetSubsystem()

Get a Subsystem of specified type

Public function Static

TSubsystemCl...

 

GetSubsystem

(
    const ULocalPlayer* LocalPlaye...
)

Get a Subsystem of specified type from the provided LocalPlayer returns nullptr if the Subsystem cannot be found or the LocalPlayer is null

Public function Const

const TArray...

 

GetSubsystemArray()

Get all Subsystem of specified type, this is only necessary for interfaces that can have multiple implementations instanced at a time.

Public function Const

ULocalPlayer...

 

GetSubsystemBase

Get a Subsystem of specified type

Public function Const

FUniqueNetId...

 

GetUniqueNetIdFromCachedControllerId()

Retrieves this player's unique net ID from the online subsystem

Protected function Virtual Const

void

 

GetViewPoint

(
    FMinimalViewInfo& OutViewInfo,
    EStereoscopicPass StereoPass
)

Retrieve the viewpoint of this player.

Public function Virtual Const

UWorld *

 

GetWorld()

Get the world the players actor belongs to

Public function

bool

 

HandleCancelMatineeCommand

(
    const TCHAR* Cmd,
    FOutputDevice& Ar
)

Public function

bool

 

HandleDNCommand

(
    const TCHAR* Cmd,
    FOutputDevice& Ar
)

Exec command handlers

Public function

bool

 

HandleExecCommand

(
    const TCHAR* Cmd,
    FOutputDevice& Ar
)

Public function

bool

 

HandleExitCommand

(
    const TCHAR* Cmd,
    FOutputDevice& Ar
)

Public function

bool

 

HandleListAwakeBodiesCommand

(
    const TCHAR* Cmd,
    FOutputDevice& Ar
)

Public function

bool

 

HandleListMoveBodyCommand

(
    const TCHAR* Cmd,
    FOutputDevice& Ar
)

Public function

bool

 

HandleListPawnComponentsCommand

(
    const TCHAR* Cmd,
    FOutputDevice& Ar
)

Public function

bool

 

HandleListSimBodiesCommand

(
    const TCHAR* Cmd,
    FOutputDevice& Ar
)

Public function

bool

 

HandleListSkelMeshesCommand

(
    const TCHAR* Cmd,
    FOutputDevice& Ar
)

Public function

bool

 

HandleMoveComponentTimesCommand

(
    const TCHAR* Cmd,
    FOutputDevice& Ar
)

Public function

bool

 

HandleToggleDrawEventsCommand

(
    const TCHAR* Cmd,
    FOutputDevice& Ar
)

Public function

bool

 

HandleToggleStreamingVolumesCommand

(
    const TCHAR* Cmd,
    FOutputDevice& Ar
)

Public function Virtual

void

 

InitOnlineSession()

Called to initialize the online delegates

Public function Const

bool

 

IsCachedUniqueNetIdPairedWithControllerId()

Returns true if the cached unique net id, is the one assigned to the controller id from the OSS

Public function Const

bool

 

IsPrimaryPlayer()

Determines whether this player is the first and primary player on their machine.

Public function Const

FOnControlle...

 

OnControllerIdChanged()

Public function Virtual

void

 

PlayerAdded

(
    UGameViewportClient* InViewpor...,
    int32 InControllerID
)

Called at creation time for internal setup

Public function Virtual

void

 

PlayerRemoved()

Called when the player is removed from the viewport client

Public function Virtual

void

 

SendSplitJoin

(
    TArray< FString >& Options
)

Send a splitscreen join command to the server to allow a splitscreen player to connect to the game the client must already be connected to a server for this function to work

Public function

void

 

SetCachedUniqueNetId

(
    TSharedPtr< const FUniqueNetId > Ne...
)

Sets the players current cached unique net id

Public function Virtual

void

 

SetControllerId

(
    int32 NewControllerId
)

Change the ControllerId for this player; if the specified ControllerId is already taken by another player, changes the ControllerId for the other player to the ControllerId currently in use by this player.

Public function Virtual

bool

 

SpawnPlayActor

(
    const FString& URL,
    FString& OutError,
    UWorld* InWorld
)

Create an actor for this player.

Overridden from UObject

Name Description

Public function Virtual

void

 

FinishDestroy()

Called to finish destroying the object.

Public function Virtual

void

 

PostInitProperties()

Called after the C++ constructor and after the properties have been initialized, including those loaded from config.

Overridden from FExec

Name Description

Public function Virtual

bool

 

Exec

(
    UWorld* InWorld,
    const TCHAR* Cmd,
    FOutputDevice& Ar
)

Exec handler

Classes

Name

Description

Public class

FOnControllerIdChanged

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