Hi,
I’m working on a legacy Unity project originally created in 2016, and I need to add a multiplayer component to it. It’s a custom implementation—not using a traditional client-server setup. I just send inputs and positions between players.
However, I’m currently stuck on an issue related to shader management.
In this project, I instantiate multiple spray guns, each with a Paint.cs script. This script creates and applies a Paint.shader that sets global shader textures like this:
- SEE SetPaintShaderSettings() below *
The problem is that Shader.SetGlobalTexture applies globally, so all spray guns end up sharing the same textures, which is not what I want. I’d like each spray gun to use its own set of textures/floats/colors — similar to how we can do it with materials using mat.SetTexture("_MainTex", texture);.
Additionally, the shader is applied to the camera using:
- SEE SetCameraReplacementShader() below *
However, I couldn’t find any way to retrieve the shader assigned to a camera via SetReplacementShader(Shader shader, string replacementTag), since there’s no getter available for that.
Do you have any ideas on how to assign unique shader parameters per spray gun, or work around the global texture limitation?
To be honest, I’m still a beginner with shaders and textures, so things are a bit unclear to me 😕
Thanks in advance!