23 lines
597 B
C#
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;
|
|
}
|
|
}
|
|
}
|
|
}
|