Hello, I’m trying to display the player name on a widget on top of my characters but I can’t make it. The reason, from I what found is that the widget component responsable of displaying the name in the character blueprint is not valid directly when the character is created.
Now my problem is that the only way to check if this widget is valid is in the tick and even there is sometimes fails. The tick says that the widget is valid and then when i want to set it, it is not valid anymore.
I’m still very new to replication in general so I suppose I’m missing something here or I don’t do this in the correct way.
Here some screenshots to help understanding what’s going on :
There is a “problem” with RepNotify - the first time it is called before Begin Play, and before the widget is created in the component.
You need to manually call the SetName function after BeginPlay.
I’ve tried this but it’s not working but I don’t see how it would since begin play is not replicated (Delay is here to make sure that the name is set before on the gamemode)
Just worked, I forgot to replicate the structure too. Thank you so much for your patience but I don’t think I understand why it was not working when calling the repnotify function in the begin play ? And why does the repnotify function was called before the begin play even though I was waiting for the widget to be valid to call it in the tick ?
This is necessary so that objects created on the server, after loading on clients, have relevant data before any actions.
RepNotify will only be called when the variable value does not match the value on the server.
Before BeginPlay the value was synchronized, RepNotify was called and when trying to set the same value again on tick - RepNotify was ignored so as not to pollute the network connection with useless information.
Ok make sense, you just saved my mental health ahah. I was also confuse because I was doing the same thing but with changing the material of my characters and one working but not the other had me very confuse, but now I understand !