Dear Epic,
In 4.6.0-1, I am unable to get a client-side Game state to send a UFUNCTION(Reliable,Server,WithValidation) function call to the server.
So to be clear, the server can call the function just fine, but the client cannot
It seems that the only two classes where the client can send server function calls back to the server are PlayerController and Character.
Why is this so?
I really need to enable custom actor classes to have client->server communication!
#.h
UCLASS()
class AGameWorld : public AGameState
{
GENERATED_BODY()
public:
AGameWorld(const FObjectInitializer& ObjectInitializer);
/** overridden to return that player controllers are capable of RPCs */
virtual bool HasNetOwner() const override;
UFUNCTION(Reliable,Server,WithValidation)
void SERVER_Test();
};
#.cpp
bool AGameWorld::HasNetOwner() const
{
return true;
}
bool AGameWorld::SERVER_Test_Validate()
{
return true;
}
void AGameWorld::SERVER_Test_Implementation()
{
UE_LOG(Joy,Error,TEXT("GAMEWORLD ~ SERVER ~ GAMEWORLD FUNC RAN"));
}
void AGameWorld::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
//~~~~~~~~~~~~
if(!HasAuthority())
{
UE_LOG(Joy,Error,TEXT("GAMEWORLD ~ CLIENT ~ GAMEWORLD FUNC RAN"));
SERVER_Test();
}
}
#What Happens
In the above code, the UE_LOG runs for the client, but the UE_LOG that is inside the server call does not run
As I mentioned, in 4.3 and during the Beta, I could easily send messages from the client to the server using the Game State Class
#Custom Actor Classes
How can I enable custom actor classes to send messages from client to server
#NetOwner
I tried putting the HasNetOwner() code in my custom actor class and in Game state, but that did not make the client able to send messages to the server.
#What Should I Do?
Thanks!
Rama