Camera rule of thirds overlay

Hello everyone, quick question here (I apologize in advance if this is a dumb question, I just can´t figure it out).

So, I want to overlay a camera field chart in my game view, in front of the scene (I find it very useful to composite the image).

What I did is to add a Canvas with a 1080 pixel image with alpha:

and then apply a very simple C# script to be sure that it will resize according to the game view size:

using UnityEngine;
using UnityEngine.UI;

[ExecuteInEditMode]
public class CameraGizmos : MonoBehaviour
{
    public RectTransform rt;

    private void Update()
    {
        rt.sizeDelta = new Vector2(Screen.width, Screen.height);
        GetComponent<CanvasScaler>().referenceResolution = new Vector2(Screen.width, Screen.height);
    }
}

That works fine, but I´d prefer a more elegant (and lighter) solution, a.k.a. a) not based on an image, and b) procedural generation of vector lines (to avoid blurriness if, for example, I resize this png to fit a portrait orientation):

Any ideas? Thank you all very much!

Something like LineRenderer?

1 Like

Thanks for your answer, Lurking-Ninja! LineRenderer was my starting point, but the problem was that Icouldn´t rotate or move them —at least that was what I think back then—; now that you mention it again, I made another try, and I find that if you uncheck the Use World Space property, they behave like any other 3D geometry, so thank you very much!

However, still seems to be some problems: obviously, it´s needed that the chart remains always in the same position relative to the camera, not only when the camera rotates or moves (that would be solved doing what I just wrote about the world space uncheck), but if you modify the field of view / focal length of the camera, the whole line renderer sort of zoom in or out, making the solution not useful.

I think the solution must around a fixed system, and the only thing I can think about is based in a UI implementation… (100% independent of the camera settings)

1 Like