Is it not possible to do a NetMulticast from within HUD? It doesn’t seem to be getting called on anything except the local caller.
I am doing a message system within my HUD
// Add a game message to the array
UFUNCTION(BlueprintCallable, Category = "GameMessage")
void AddGameMessage(FString Message, FLinearColor TextColor, FLinearColor BackgroundColor, bool bShouldBroadcast);
// Broadcast the game message to everyone
UFUNCTION(Reliable, NetMulticast)
void BroadcastGameMessage(FFPSGameMessage GameMessage);
void AFPSHUD::AddGameMessage(FString Message, FLinearColor TextColor, FLinearColor BackgroundColor, bool bShouldBroadcast)
{
// Create the new game message
FFPSGameMessage NewMessage;
// Set the message text
NewMessage.Message = Message;
// Set the text color
NewMessage.TextColor = TextColor;
// Set the background color
NewMessage.BackgroundColor = BackgroundColor;
// If this message should be broadcasted
if (bShouldBroadcast)
{
BroadcastGameMessage(NewMessage);
}
else
{
// Add the new message to the array locally
GameMessages.Add(NewMessage);
}
}
void AFPSHUD::BroadcastGameMessage_Implementation(FFPSGameMessage GameMessage)
{
GameMessages.Add(GameMessage);
}
I really wanted to keep the messages on the HUD object like I am currently doing. It feels clean to me.
Does anyone know a clean way to do this?
Do I need to split this out to PlayerState? If so is there some unintrusive way?
Thanks!