Created
December 3, 2014 00:30
-
-
Save EsProgram/a5824f446a3ecaed8189 to your computer and use it in GitHub Desktop.
時間経過でDestroy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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