Files
xpeng 8b757d7ed1 fix config panel raycast issue
This is not a perfect fix because if the config p is opened on window side the vr side will broken
2023-03-06 19:14:10 +01:00

27 lines
504 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[RequireComponent(typeof(Canvas))]
public class CanvasCameraSwitcher : MonoBehaviour
{
public Camera Camera;
private Canvas Canvas;
void Start()
{
Canvas = GetComponent<Canvas>();
}
public void EnableCanvasCamera(bool value)
{
if (value)
{
Canvas.worldCamera = Camera;
}
else
{
Canvas.worldCamera = null;
}
}
}