作者:鹰击长空1943 | 来源:互联网 | 2023-10-13 13:08
打开关卡前发送参数constFStringTravelURLIPAddress:Port;FStringParamTEXT();ParamTEXT(?OculusID)
打开关卡前发送参数
const FString TravelURL = IPAddress + ":" + Port;
FString Param = TEXT("");
Param += TEXT("?OculusID=") + OculusID + MapName;
FString FinalURL = TravelURL + Param;
UGameplayStatics::GetPlayerController(this, 0)->ClientTravel(FinalURL, ETravelType::TRAVEL_Absolute);
在打开关卡时加载参数
重载GameMode的InitNewPlayer函数 从其中的Option中进行读取
GameMode::InitNewPlayer(APlayerController * NewPlayerController, const FUniqueNetIdRepl & UniqueId, const FString & Options, const FString & Portal)
{
FString OculusID = UGameplayStatics::ParseOption(Options, TEXT("OculusID"));
}