Occlusion Masking for local multiplayer.

Hi all,

I have built the whole occlusion masking system just like BG3. and it works perfectly fine for a single player. BUT when I add a second local player things starts to break and it try to mask for each player per frame. One player per frame randomly. and this is not what I was aiming for. How would I do a smooth Occlusion masking for 4 local multiplayers game (shared camera)?

My system so far:

-Shared Camera.

-Line trace from shared camera to all players to check if there is a wall in between to mask it.

-One MF that does the masking, and it check which player is close to a wall to mask it.

-Material that checks if we need to mask or not.

-2-4 local players.

Any help appreciated.

Many thanks,