Files
2026-02-21 16:46:09 -08:00

21 lines
566 B
C#

using UnityEngine;
namespace LeTai.Asset.TranslucentImage.Demo
{
public class WorldSpaceSetup : MonoBehaviour
{
public Camera sceneCamera;
public Camera uiCamera;
public void Toggle()
{
//In always on top mode, main camera shouldn't render the UI
//Equivalent to toggling the layer "UI" in the inspector
sceneCamera.cullingMask ^= 1 << LayerMask.NameToLayer("UI");
//Instead, another camera that have higher depth should do that.
uiCamera.gameObject.SetActive(!uiCamera.gameObject.activeSelf);
}
}
}