I want to add a tag to the pawns from the Game Mode.
Everything I tried doesn’t work.
In the end I have noticed that there is a desynchronization between the spawning moment, and the possession of the pawn by the controller, and the event Possessed execution moment.
So when the possessed event is executed the controller still doesn’t know anything about its pawn. (Get Controlled Pawn does not work)
So I need to know when everything is well synchronized to make a correct request to the server. Because the use of “delay” I think is a wrong solution.
Is there any event or method that allows me to know when everything is in sync?
Could it be that the problem is that onrep_teamTag failes early? That maybe the UI healthbar has not spawned yet and failes the cast? Try adding a break point on the on_rep_teamTag & stepping through with F10 and see if it get through the whole process (or even it it is called at all)
Ok, I’ll try that and see what I can find. I’m actually using the health bar text to check if it works. The ultimate goal is to put the tag in the actor properties. The problem is that I can’t select an actor at runtime to see its properties because the editor slows down so much. It didn’t crash but almost.
Ok, I’ll try to do the debug trace.
I will tell you about it.
Thank you very much!!
Yeah, something is wrong with the health bar… I don’t know what it is… when I put multiple players the health bar is visible from the other players… and it works when the player takes damage… then it doesn’t I understand why when debugging there is an invalid cast.
The delay may be needed due to it being probably a widgetcomponent inside the actor that needs to be spawned & initialized. It might need some time for it to become valid.
I mean, the delay waits one second. But maybe the widget needs more or less time to be generated… if it needs more than a second then it’s going to fail anyway. That’s why I don’t like delays…
There might be a way around the delay (probably more important on first spawn) maybe make the delay time a parameter and after first runctry setting itnto zero. I’ll let you know if i find a better way in the future
You don’t need to answer.
I’ve tested it.
It doesn’t work like I thought… It only checks the server side.
So the replicas also load the health bar with delay.
So it doesn’t solve any problem.
Your solution is the best in combination with the little macro I posted above.