Skip to content

Instantly share code, notes, and snippets.

@EsProgram
Created December 3, 2014 00:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EsProgram/a5824f446a3ecaed8189 to your computer and use it in GitHub Desktop.
Save EsProgram/a5824f446a3ecaed8189 to your computer and use it in GitHub Desktop.
時間経過でDestroy
using System.Collections;
using UnityEngine;
public class TimeDestroy : MonoBehaviour
{
[SerializeField]
private float destroyTime = default(float);
private float start;
private void Start()
{
start = Time.time;
}
private void Update()
{
if(destroyTime < Time.time - start)
Destroy(this.gameObject);
}
public void SetTime(float time)
{
destroyTime = time;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment