UE 5.1
It seems, this problem very old, and, actually, looks like a forgotten bug.
When a Player (Client in a Multiplayer game), in a case of gameplay, Possess a new Character, like in Respawn situation, Possessed Character can’t use “Simple Move to Location” function.
In some cases we can got an error “SimpleMove failed for X: movement not allowed”, in some cases we don’t, but, symptom is the same - its like "Allow Client Side Navigation” is False, but its True.
During web research, i find this article, and its says the reason is Components not updating correctly.
So, when this bug will be fixed, and how to deal with this problem, until its don’t?
Best way to bypass this problem in a blueprint, or, at least, how to use the solution from the article, if its legit?
You need to create a C++ class that inherits from the Player Controller, just like you do when creating blueprints. After creation, the Visual Studio editor will open, where you will see 2 files with the extension .h and .cpp.
In the .h file you need to add after GENERATED_BODY():
public:
UFUNCTION(BlueprintCallable)
void SimpleClientNavMove(const FVector& Destination);
To the .cpp file on the last line:
void AMySamplePlayerController::SimpleClientNavMove(const FVector& Destination)
{
UPathFollowingComponent* PathFollowingComp = FindComponentByClass();
if (PathFollowingComp == nullptr)
{
PathFollowingComp = NewObject(this);
PathFollowingComp->RegisterComponentWithWorld(GetWorld());
PathFollowingComp->Initialize();
}
if (!PathFollowingComp->IsPathFollowingAllowed())
{
// After a client respawn we need to reinitialize the path following component
// The default code path that sorts this out only fires on the server after a Possess
PathFollowingComp->Initialize();
}
UAIBlueprintHelperLibrary::SimpleMoveToLocation(this, Destination);
}
Where is the AMySamplePlayerController should be replaced with the name of the created file with the prefix A at the beginning
Further, in the same .cpp file, in the Include block, you need to write: #include “Blueprint/AIBlueprintHelperLibrary.h” #include “Navigation/PathFollowingComponent.h”
Now, in order for everything to compile correctly, you need to add the “AIModule” module in the assembly file (YourProjectName.Build.cs) to the section PrivateDependencyModuleNames.AddRange.
After complie and run Unreal Engine you need creating blueprint inherits from your created cpp file, just click all classes and finded it.
And finily use SimpleClientNavMove node Instead of SimpleMoveToLocation
I hope I explained clearly and it will help you. If you write anything, I’m ready to help.