I have a problem with rpc in actor component. I have Test() function, Server_Test() function and Multicast_Test() function in my actor component class.
void Test();
UFUNCTION(Server,Reliable)
void Server_Test();
void Server_Test_Implementation();
UFUNCTION(NetMulticast,Reliable)
void Multicast_Test();
void Multicast_Test_Implementation();
Here is the constructor:
UBaseActorComponent::UBaseActorComponent()
{
PrimaryComponentTick.bCanEverTick = false;
SetIsReplicated(true);
SetIsReplicatedByDefault(true);
}
I call Test() function in the BeginPlay(). Here is the implementation:
void UBaseActorComponent::BeginPlay()
{
Super::BeginPlay();
Test();
}
void UBaseActorComponent::Test()
{
if(GetOwner()->HasAuthority())
{
UE_LOG(LogTemp,Error,TEXT("HasAuthority"));
}
else if(!(GetOwner()->HasAuthority()))
{
UE_LOG(LogTemp,Error,TEXT("CLIENT"));
Server_Test();
}
}
void UBaseActorComponent::Server_Test_Implementation()
{
UE_LOG(LogTemp,Error,TEXT("Server Test Called %s - %s "),*GetName(),*GetOwner()->GetName());
Multicast_Test();
}
void UBaseActorComponent::Multicast_Test_Implementation()
{
UE_LOG(LogTemp,Error,TEXT("Multicast Test Called %s - %s "),*GetName(),*GetOwner()->GetName());
}
In blueprint, set replicated also marked as ticked. I start the game in Listen Server with two players:
And this is the output log:
1 - Why HasAuthority and CLIENT log printed twice?
2- Why am i getting Server_Test will not be processed error?
3- After the error, how is replication functions log printed?
4- Are Game Sessions logs important?
Apparently, i am doing something wrong. What should i do?
(I have to make those RPC’s in actor component.)
Thanks a lot in advance.