I am currently working on a 2D project, and I want to make the camera follow a character. I have managed to do this, but the problem is that the elements I want to be UI remain static, and when the player moves through the world, they are lost at fixed points.
As a solution, I thought about implementing two cameras, one would be responsible for following the player and rendering the world behind them, and the other would be responsible for rendering the HUD.
I’ve tried different ways, but one camera always renders on top of the other.
Both are handled in the same way. Create a layer for the HUD, specifically layer 19.
Create an extra camera in which I want to render the HUD, and I want the existing one to render the entire world.
The camera that I want to render the entire world is the same camera that corresponds to the existing canvas.
But the result when I run the engine is the same: only one camera is rendered.
I tried creating different canvases, one for each camera, and the result is the same: only one is rendered at a time.’
Does anyone know how I can manage both actions in a 2D environment, make the camera follow the player through the world, and have a HUD system that keeps the player informed of their surroundings?