Add Unreal Engine library
This commit is contained in:
17
SilentHillF/UETools.cpp
Normal file
17
SilentHillF/UETools.cpp
Normal file
@@ -0,0 +1,17 @@
|
||||
#include "UETools.hpp"
|
||||
#include "SDK/Engine_classes.hpp"
|
||||
|
||||
SDK::APawn* GetPawnFromWorld(SDK::UWorld* world) {
|
||||
if (!world) world = SDK::UWorld::GetWorld();
|
||||
if (!world) return nullptr;
|
||||
|
||||
SDK::UGameInstance* gameInstance = world->OwningGameInstance;
|
||||
if (!gameInstance || gameInstance->LocalPlayers.Num() == 0) return nullptr;
|
||||
SDK::ULocalPlayer* localPlayer = gameInstance->LocalPlayers[0];
|
||||
if (!localPlayer) return nullptr;
|
||||
SDK::APlayerController* pc = localPlayer->PlayerController;
|
||||
if (!pc) return nullptr;
|
||||
SDK::APawn* pawn = pc->AcknowledgedPawn;
|
||||
|
||||
return pawn;
|
||||
}
|
||||
Reference in New Issue
Block a user