Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/jackmawer/JacksWorld. An abandoned mini-project that I created while learning to use Unity with networking.
Something went wrong. Try again.
561 B · 27 lines
C#
at master
12345678910111213141516171819202122232425262728using System;using UnityEngine;
namespace UnityStandardAssets.Utility{ public class TimedObjectDestructor : MonoBehaviour { [SerializeField] private float m_TimeOut = 1.0f; [SerializeField] private bool m_DetachChildren = false;
private void Awake() { Invoke("DestroyNow", m_TimeOut); }
private void DestroyNow() { if (m_DetachChildren) { transform.DetachChildren(); } DestroyObject(gameObject); } }}