- Home /
How could I make objects highlighted in one camera also highlighted in another camera?
I have a drone for my player that when active, will highlight enemies through walls that are within range.
The drone's primary camera has a child Xray-camera with an Xray script and shader and has a higher depth than the drone's primary cam, so that the outline of the enemy is rendered on top of whatever the primary camera sees.
What I would like to do is have those enemies that are within the drone camera's view (either directly or through walls) also highlighted for the player when they leave the drone hovering - so that a player could position the drone where they want and then regain control and use the Xray information to help them progress.
I originally thought I could add an identical Xray child camera to the player's camera but this will make it act the same as the drone and only highlight enemies within the player camera's range, making the drone obsolete.
Another thought I had was to switch the enemy's shader to the Xray from standard when it is in the drone camera's view, and back to standard when it is not in view, but I do not know how feasible it is to be switching shaders at runtime.
Has anyone got any advice as to how I could go about doing this?