Navigation
Unreal Engine C++ API Reference > Runtime > Engine > Engine
Inheritance Hierarchy
- UObjectBase
- UObjectBaseUtility
- UObject
- UPlayer
- ULocalPlayer
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/listen server has a LocalPlayer. It stays active across maps, and there may be several spawned in the case of splitscreen/coop. There will be 0 spawned on dedicated servers.
Variables
Type | Name | Description | |
---|---|---|---|
![]() |
TEnumAsByte< enum EAspectRatioAxisConstraint > | AspectRatioAxisConstraint | How to constrain perspective viewport FOV |
![]() |
uint32: 1 | bSentSplitJoin | Set when we've sent a split join request |
![]() |
FUniqueNetIdRepl | CachedUniqueNetId | The FUniqueNetId which this player is associated with. |
![]() |
FVector | LastViewLocation | The location of the player's view the previous frame. |
![]() |
FVector2D | Origin | The coordinates for the upper left corner of the primary viewport subregion allocated to this player. |
![]() |
TSubclassOf< class APlayerController > | PendingLevelPlayerControllerClass | The class of PlayerController to spawn for players logging in. |
![]() |
FVector2D | Size | The size of the primary viewport subregion allocated to this player. 0-1 |
![]() |
FReply | SlateOperations | FReply used to defer some slate operations. |
![]() |
TObjectPtr< class UGameViewportClient > | ViewportClient | The primary viewport containing this player's view. |
Constructors
Type | Name | Description | |
---|---|---|---|
![]() |
ULocalPlayer
(
const FObjectInitializer& ObjectInitializer |
||
![]() |
ULocalPlayer
(
FVTableHelper& Helper |
DO NOT USE. This constructor is for internal usage only for hot-reload purposes. |
Functions
Type | Name | Description | |
---|---|---|---|
![]() ![]() |
void | AddReferencedObjects
(
UObject* InThis, |
|
![]() ![]() |
FSceneView * | CalcSceneView
(
FSceneViewFamily* ViewFamily, |
Calculate the view settings for drawing from this view actor |
![]() ![]() |
bool | CalcSceneViewInitOptions
(
FSceneViewInitOptions& OutInitOptions, |
Calculate the view init settings for drawing from this view actor |
![]() ![]() |
void | CleanupViewState
(
FStringView MidParentRootPath |
Clear cached view state. |
![]() |
void | ExecMacro
(
const TCHAR* Filename, |
|
![]() ![]() |
FUniqueNetIdRepl | Retrieves this player's unique net ID that was previously cached | |
![]() ![]() |
int32 | Returns the controller ID for the player. | |
![]() ![]() |
UGameInstance * | Get the game instance associated with this local player | |
![]() ![]() ![]() |
FString | 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. | |
![]() ![]() |
int32 | Returns the index of this player in the Game instances local players array | |
![]() ![]() ![]() |
int32 | Returns the logical local player index where 0 is the first LocalPlayer that was created. | |
![]() ![]() ![]() |
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 |
![]() ![]() |
bool | GetPixelBoundingBox
(
const FSceneViewProjectionData& ProjectionData, |
This function will give you two points in Pixel Space that surround the World Space box. |
![]() |
bool | GetPixelBoundingBox
(
const FBox& ActorBox, |
This function will give you two points in Pixel Space that surround the World Space box. |
![]() |
bool | GetPixelPoint
(
const FVector& InPoint, |
This function will give you a point in Pixel Space from a World Space position |
![]() ![]() |
bool | GetPixelPoint
(
const FSceneViewProjectionData& ProjectionData, |
This function will give you a point in Pixel Space from a World Space position |
![]() ![]() |
FPlatformUserId | Returns the platform user that is assigned to this player | |
![]() ![]() ![]() |
int32 | Converts the platform user id to an index where 0 is the first logged in user. | |
![]() ![]() ![]() |
FUniqueNetIdRepl | Retrieves the preferred unique net id. | |
![]() ![]() ![]() |
bool | GetProjectionData
(
FViewport* Viewport, |
Helper function for deriving various bits of data needed for projection |
![]() ![]() |
const FReply & | ||
![]() |
FReply & | Getter for slate operations. | |
![]() ![]() |
TSharedPtr< FSlateUser > | GetSlateUser () |
Get the SlateUser that this LocalPlayer corresponds to |
![]() ![]() ![]() |
TSharedPtr< const FSlateUser > | GetSlateUser () |
Get the SlateUser that this LocalPlayer corresponds to |
![]() ![]() |
TSubsystemClass * | GetSubsystem
(
const ULocalPlayer* LocalPlayer |
Get a Subsystem of specified type from the provided LocalPlayer returns nullptr if the Subsystem cannot be found or the LocalPlayer is null |
![]() ![]() |
TSubsystemClass * | GetSubsystem () |
Get a Subsystem of specified type |
![]() ![]() |
const TArray< TSubsystemClass * > & | Get all Subsystem of specified type, this is only necessary for interfaces that can have multiple implementations instanced at a time. | |
![]() ![]() |
ULocalPlayerSubsystem * | GetSubsystemBase
(
TSubclassOf< ULocalPlayerSubsystem > SubsystemClass |
Get a Subsystem of specified type |
![]() ![]() ![]() |
FUniqueNetIdRepl | Retrieves this player's unique net ID from the online subsystem using the platform user Id | |
![]() ![]() |
FUniqueNetIdRepl | This should be deprecated when engine code has been changed to expect FPlatformUserId UE_DEPRECATED(5.x, "Use GetUniqueNetIdForPlatformUser instead") | |
![]() ![]() ![]() |
void | GetViewPoint
(
FMinimalViewInfo& OutViewInfo |
Retrieve the viewpoint of this player. |
![]() ![]() ![]() |
UWorld * | GetWorld () |
Get the world the players actor belongs to |
![]() |
bool | HandleDNCommand
(
const TCHAR* Cmd, |
Exec command handlers |
![]() |
bool | HandleExecCommand
(
const TCHAR* Cmd, |
|
![]() |
bool | HandleExitCommand
(
const TCHAR* Cmd, |
|
![]() |
bool | HandleListAwakeBodiesCommand
(
const TCHAR* Cmd, |
|
![]() |
bool | HandleListMoveBodyCommand
(
const TCHAR* Cmd, |
|
![]() |
bool | HandleListPawnComponentsCommand
(
const TCHAR* Cmd, |
|
![]() |
bool | HandleListSimBodiesCommand
(
const TCHAR* Cmd, |
|
![]() |
bool | HandleListSkelMeshesCommand
(
const TCHAR* Cmd, |
|
![]() |
bool | HandleMoveComponentTimesCommand
(
const TCHAR* Cmd, |
|
![]() |
bool | HandleToggleDrawEventsCommand
(
const TCHAR* Cmd, |
|
![]() |
bool | HandleToggleStreamingVolumesCommand
(
const TCHAR* Cmd, |
|
![]() ![]() |
void | Called to initialize the online delegates | |
![]() ![]() |
bool | Determines whether this player is the first and primary player on their machine. | |
![]() ![]() |
FOnControllerIdChanged & | ||
![]() |
FOnPlatformUserIdChanged & | ||
![]() |
FOnPlayerControllerChanged & | ||
![]() ![]() |
void | PlayerAdded
(
UGameViewportClient* InViewportClient, |
Called at creation time for internal setup |
![]() ![]() |
void | PlayerAdded
(
UGameViewportClient* InViewportClient, |
Called at creation time for internal setup |
![]() ![]() |
void | Called when the player is removed from the viewport client | |
![]() ![]() |
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 |
![]() |
void | SetCachedUniqueNetId
(
const FUniqueNetIdRepl& NewUniqueNetId |
Sets the players current cached unique net id |
![]() ![]() |
void | SetControllerId
(
int32 NewControllerId |
Change the physical 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. |
![]() ![]() |
void | SetPlatformUserId
(
FPlatformUserId InPlatformUserId |
Changes the platform user that is assigned to this player |
![]() ![]() |
bool | SpawnPlayActor
(
const FString& URL, |
Create an actor for this player. |
Overridden from UPlayer
Type | Name | Description | |
---|---|---|---|
![]() ![]() |
void | ReceivedPlayerController
(
APlayerController* NewController |
Called when this player has had it's outer Player Controller set for remote net connections |
Overridden from UObject
Type | Name | Description | |
---|---|---|---|
![]() ![]() |
void | Called to finish destroying the object. |
Overridden from FExec
Type | Name | Description | |
---|---|---|---|
![]() ![]() |
bool | Exec_Editor
(
UWorld* InWorld, |
Implementation of Exec that is only called in editor |
Classes
Type | Name | Description | |
---|---|---|---|
![]() |
FOnControllerIdChanged | ||
![]() |
FOnPlatformUserIdChanged | Event called when this local player has been assigned to a new platform-level user | |
![]() |
FOnPlayerControllerChanged | Event called when this local player has had a new outer PlayerController set | |
![]() |
FOptionalAllottedSize |
Deprecated Functions
Type | Name | Description | |
---|---|---|---|
![]() ![]() |
bool | GetPixelBoundingBox
(
const FSceneViewProjectionData& ProjectionData, |
Please use const FVector2f* directly |
![]() |
bool | GetPixelBoundingBox
(
const FBox& ActorBox, |
Please use const FVector2f* directly |
![]() |
bool | GetPixelPoint
(
const FVector& InPoint, |
Please use const FVector2f* directly |
![]() ![]() |
bool | GetPixelPoint
(
const FSceneViewProjectionData& ProjectionData, |
Please use const FVector2f* directly |
![]() ![]() |
bool | Platform User Id now has priority over ControllerId, these are not expected to be the same | |
![]() |
void | SetCachedUniqueNetId
(
TYPE_OF_NULLPTR |
Use SetCachedUniqueNetId with FUniqueNetIdRepl |
![]() |
void | SetCachedUniqueNetId
(
FUniqueNetIdPtr NewUniqueNetId |
Use SetCachedUniqueNetId with FUniqueNetIdRepl |