r2mods/ilspy_dump/ror2_csproj/RoR2/DestroyOnUnseen.cs

24 lines
323 B
C#
Raw Normal View History

2024-10-04 07:26:37 +00:00
using UnityEngine;
namespace RoR2;
public class DestroyOnUnseen : MonoBehaviour
{
public bool cull;
private Renderer rend;
private void Start()
{
rend = GetComponentInChildren<Renderer>();
}
private void Update()
{
if (cull && (bool)rend && !rend.isVisible)
{
Object.Destroy(base.gameObject);
}
}
}