Added things

This commit is contained in:
2022-05-13 13:29:38 +07:00
parent 85518c4f3f
commit abf262095f
589 changed files with 851744 additions and 0 deletions

View File

@ -0,0 +1,35 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
//This code destroys the particle's GameObject once it's Start Time is over.
public class AutoDestroyPS : MonoBehaviour
{
private float timeLeft;
private void Awake()
{
ParticleSystem system = GetComponent<ParticleSystem>();
var main = system.main;
timeLeft = main.startLifetimeMultiplier + main.duration;
Destroy(gameObject, timeLeft);
}
/*--------------------------bad variant------------------------
public void Awake()
{
ParticleSystem system = GetComponent<ParticleSystem>();
var main = system.main;
timeLeft = main.startLifetimeMultiplier + main.duration;
//Destroy(gameObject, main.startLifetimeMultiplier + main.duration);
}
public void Update()
{
timeLeft -= Time.deltaTime;
if (timeLeft <= 0)
{
GameObject.Destroy(gameObject);
}
}
-----------------------------------------------------------*/
}