Files
fnl/Assets/Extensions/Le Tai's Asset/TranslucentImage/Demo/Scripts/WorldSpaceSetup.cs

21 lines
566 B
C#
Raw Normal View History

2026-02-21 16:40:15 -08:00
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);
}
}
}