Hi,
I encountered a problem when using Iris in UE5.6. I have many separate operations according to IsLocallyControlled() in BeginPlay(), such as if player is not locally controlled then he won’t create a widget on him.
The problem is that after enabling Iris, IsLocallyControlled() on client will return a wrong value in BeginPlay(). The return value only becomes correct after about 0.5s later.
Does anyone can help?
Edit:
I find it that in the BeginPlay() of player character, GetController() returns nullptr. Does this mean PlayerController has not set for client at that time? Why will this happen?
the null controller in BeginPlay is a timing shift, under Iris the pawn can run BeginPlay before the controller link replicates, so the locally controlled query reads stale data for about half a second. move the widget branch to OnPossess or to a controller-ready callback instead of BeginPlay.
cache the controlled state once the possess fires and drive widget creation from there, which behaves the same on legacy and Iris paths in 5.6.
you can also look at Iris Readiness Kit, an Iris replication plugin that spots the BeginPlay orderings that shift under Iris: Iris Readiness Kit — Audit Your Project Before Enabling Iris Replication | Fab there’s a shorts playlist on iris filtering basics too: https://www.youtube.com/playlist?list=PLWrCzz951TwA