Correct usage of "Is locally controlled" in Character? [4.8.3, Blueprints]
I want to initialize my Pawn/Character. Some things for the locally controlled Character, like creating a HUD. On the other hand some things for all but the locally controlled, like setting their mesh's material to enemy or friendly colors and creating a healthbar over their heads.
At first I tried setting up everything in Event BeginPlay, but that was problematic since "Is locally Controlled" did not work as expected. (Always returning false, for details just search here for "locally controlled")
I worked around it with a Delay, but Delays might (and did) not work everytime and I like to do it the correct way. I read about the problem and found out some ppl have the same problem. And I seen many "dirty" solutions like the Delay and some which sounded cleaner.
What I tried:
This is not really a good situation. I think every new developer will stumble upon this non-obvious behavior when using "Is locally controlled".
Essentially the current state means; I can't make descisions in BeginPlay and I need to break out of Tick as long as Im not sure if everything is set up.
Sidenote: using a "Run on owning Client" instead of a Multicast from "Event Possessed" worked, but it did not solve my setup needs for all the non-local clients (creating healthbar, setting colors) since the message is not transmitted to them. This even fixed "Event Tick"s behavior of not knowing if it is locally controlled AFAICT.
UPDATE to Sidenote: AND it fixes "BeginPlay", the local client knows who he is, if there is a "Run on owning Client" executed before, even if it does nothing... strange.
asked Aug 24 '15 at 04:00 PM in Blueprint Scripting
Follow this question
Once you sign in you will be able to subscribe for any updates here