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!