Files
PrinceOfGlory/Assets/Scripts/Help/SetCanvasCamera.cs
kridoo 6e91a0c7f0 111
2025-09-15 17:32:08 +08:00

23 lines
597 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SetCanvasCamera : MonoBehaviour
{
public Canvas canvas;
public Camera targetCamera;
// Start is called before the first frame update
void Start()
{
canvas = GetComponent<Canvas>();
targetCamera = GameObject.Find("XROriginHands/Camera Offset/Main Camera").GetComponent<Camera>();
if (canvas!=null)
{
if (canvas != null && targetCamera != null)
{
canvas.worldCamera = targetCamera;
}
}
}
}