2015-11-17 22:36:21 -05:00

23 lines
477 B
C#

using UnityEngine;
using System.Collections;
public class Destroyer : MonoBehaviour
{
public bool destroyOnAwake; // Whether or not this gameobject should destroyed after a delay, on Awake.
public float awakeDestroyDelay; // The delay for destroying it on Awake.
void Awake ()
{
// If the gameobject should be destroyed on awake,
if(destroyOnAwake)
{ // ... destroy the gameobject after the delay.
Destroy(gameObject, awakeDestroyDelay);
}
}
}