The title says it all. I’d like to know the width and height of the canvas in world space, not screen space. I know that when the canvas’ render mode is in screen space overlay, the width and height are the same as Screen.width and Screen.height. Any help is appreciated.
float panelWidth = menuCanvasRectTransform.rect.width * menuCanvasRectTransform.localScale.x;
float panelHeight = menuCanvasRectTransform.rect.height * menuCanvasRectTransform.localScale.y;
void Start()
{
RectTransform parentCanvas = GetComponentInParent().GetComponent();
Vector2 canvasWidthHeight = new Vector2(parentCanvas.rect.width, parentCanvas.rect.height);
}
And it’s important that this is inside Start() and not Awake().