Files
tcg-client/Assets/TcgEngine/Scripts/Tools/DeviceVisibility.cs
yaoyanwei 2f2a601227 init
2025-08-04 16:45:48 +08:00

25 lines
630 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace TcgEngine.UI
{
/// <summary>
/// Add to any UI component to make it visible or invisible based on the device
/// </summary>
public class DeviceVisibility : MonoBehaviour
{
public bool desktop = true;
public bool mobile = true;
void Start()
{
bool ismobile = GameTool.IsMobile();
if (ismobile && !mobile)
gameObject.SetActive(false);
else if (!ismobile && !desktop)
gameObject.SetActive(false);
}
}
}