Here’s the setup:
- Each player character has a child actor that’s responsible for the player’s vision cone.
- This child actors contains a Post Process component. On Begin Play it creates its own dynamic instance of the base material, which will be used as a post process material, and its own Render Target 2D to be used as a texture parameter in the said material.
- It sets the Render Target 2D as the material parameter, and sets the material as the Post Process material.
- The material also contains a vector parameter named PlayerLocation that’s supposed to be updated on tick.
If I launch the game with 1 player or as Play Standalone, the vision cones work as intended. But if I launch Play As Listen Server or Play As Client, the PlayerLocation parameters start being controlled by wrong players. The vision cone direction and shape are correct, but the location is not, and it starts following a seemingly random other player instead of the one that owns it.
In my understanding, each actor should have its own dynamic material and they shouldn’t be able to affect each other’s materials, but they do for some reason.
I tried this setup in both Blueprints and C++, and it’s the same. As soon as another player is created, the PlayerLocation parameter breaks.
Why does this happen and how can I fix it?