Is Locally Controlled function returns false on client's controlled local pawn

I saw a bug similar to this posted late last year, but it was marked resolved due to inactivity. In some of my prototyping, I noticed that Is Locally Controlled incorrectly returns false on a client’s local controlled pawn when called on Event Begin Play, but correctly returns true when called from a listen server’s controlled pawn. If Is Locally Controlled is called from another run-time event on client, it then returns true. I have attached blueprints I used to produce this with a single client connected to a dedicated server, but results for multiple clients and/or when connected to a listen server are same. This has only been performed by launching game instances from UnrealEd and not individually from binary executables. Let me know if there is anything else I can provide!

38935-event_graph_locallycontrolledbool.jpg

4.7.5 - Apologies for not appending resolved report.

Hi oti2,

I believe what you’re experiencing is a delay between Begin Play on pawn and possession of pawn by Client’s controller. pawn is created on Server and Client before all Clients are fully logged in, so this delay makes sense. If you use a Delay node with about 1 second, you should see it return True, as you’ve given it time to be possessed by Client’s controller.

A better way to do this (because relying on a Delay when you don’t know exact amount of time it will take for Client to log in and possess pawn) is to use EventPostLogin in GameMode. From here, you can call events and functions in other classes, such as Player Controller (which might be a better place for this type of thing. IsLocallyControlled is better used as a check after Clients already have their controllers assigned and their pawns possessed.

Hope that helps!

call it after EventBeginPlay,for example call it in EventTick

What you can also do is use event tick. First do a branch checking if pawn is controlled. If yes, then do a branch to check if pawn is locally controlled. Then, do your thing.

For example, here i used this method in one of my own projects to hide a text render for each player but only locally. I didn’t want player to see his own name tag above his head so what i did was each time a pawn is possesed by a player pawn’s textrender gets hidden. When a pawn is no longer possesed do once gets reset so when potentially another player possesses pawn textrender can get hidden again for that client but not for others.

@wixZ WixZ solution is great, I would change using Is Is Controlled to Is Player Controlled, as in my case Is Controlled wasn’t working on remote simulated proxies, so there would be no way to find out on simulated clients when they were ready. Cheers

WixZ solution is great, I would change using Is Is Controlled to Is Player Controlled, as in my case Is Controlled wasn’t working on remote simulated proxies, so there would be no way to find out on simulated clients when they were ready. Cheers

call it after on possessed for better because it run one time.(After pawn has been possessed)

Begin Play Call from pawn has been create.Possessed Call after server has done assign controller to pawn.

P.S : Some one correct me if i was wrong (Thank You).

346275-temp.png