经过正确创建文件
现在就有C++文件了
UFUNCTION(BlueprintCallable) void OpenLobby(); UFUNCTION(BlueprintCallable) void CallOpenLevel(const FString& Address); UFUNCTION(BlueprintCallable) void CallClientTravel(const FString& Address); #include "Kismet/GameplayStatics.h" void Aproject1Character::OpenLobby() { UWorld* World = GetWorld(); if (World) { World->ServerTravel("/Game/ThirdPerson/Maps/Lobby?listen"); } } void Aproject1Character::CallOpenLevel(const FString& Address) { UGameplayStatics::OpenLevel(this, *Address); } void Aproject1Character::CallClientTravel(const FString& Address) { APlayerController* PlayerController = GetGameInstance()->GetFirstLocalPlayerController(); if (PlayerController) { PlayerController->ClientTravel(Address,ETravelType::TRAVEL_Absolute); } }
不知道为什么报错
标签:const,代码,虚幻,BlueprintCallable,C++,Address,Aproject1Character,void,FString From: https://www.cnblogs.com/youxiandechilun/p/18339666