您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
27 行
574 B
27 行
574 B
using 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();
|
|
}
|
|
UnityEngine.Object.Destroy(gameObject);
|
|
}
|
|
}
|
|
}
|