Files
BITKit/Src/Unity/Scripts/Scenes/UnityAutoDestroyOnStart.cs

22 lines
426 B
C#
Raw Normal View History

2025-03-09 13:38:23 +08:00
using System.Collections;
using System.Collections.Generic;
2025-03-24 14:42:40 +08:00
using BITKit;
2025-03-09 13:38:23 +08:00
using UnityEngine;
public class UnityAutoDestroyOnStart : MonoBehaviour
{
2025-03-24 14:42:40 +08:00
[SerializeField] private bool inActive;
2025-03-09 13:38:23 +08:00
// Start is called before the first frame update
void Start()
{
2025-03-24 14:42:40 +08:00
if (inActive)
{
gameObject.SetActive(false);
}
else
{
Destroy(gameObject);
}
2025-03-09 13:38:23 +08:00
}
}