Download

NetMulticast function executed on unrelevant clients

I’ve created a character that override this function “IsNetRelevantFor”, this function works perfectly.

The problem is this, when I execute an event net multicast this function is executed on all clients either on the clients where the actor is not relevant. The actor becomes again visible for 2/3 sec then will be destroyed because is not relevant…

why this happens?

I need control the relevancy to not send the position of players in some circustance, this behaviour break this rule.

What am I doing wrong?

Do you have a sample of the code in the overriden function to help us determine what could be the issue?

Yes of course,


bool ATestCharacter::IsNetRelevantFor(AActor const * RealViewer, AActor const * ViewTarget, FVector const & SrcLocation) const {
	if (this == ViewTarget) {
		return true;
	} else {
		return false;
	}
}

As I said the problem is not the function “IsNetRelevantFor” because the other character (that is always not relevant) after NetMulticast function’s call appears and after 2/3 sec disappear again.

The NetMulticast function is:

Header


UFUNCTION(NetMulticast, Reliable)
void EVENT_OnServerFireTriggerPressed();
void EVENT_OnServerFireTriggerPressed_Implementation();

CPP


void ATestCharacter::EVENT_OnFireTriggerPressed_Implementation() {
	if (ROLE_SimulatedProxy == Role) {
		bIsFireTriggerPressed = true;
	}
}

Thanks for the help