您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
21 行
512 B
21 行
512 B
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class PoolTester : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
private ParticlePoolSO _pool = default;
|
|
|
|
private IEnumerator Start()
|
|
{
|
|
List<PoolableParticle> particles = _pool.Request(10) as List<PoolableParticle>;
|
|
foreach (PoolableParticle particle in particles)
|
|
{
|
|
particle.transform.position = Random.insideUnitSphere * 5f;
|
|
particle.Play();
|
|
}
|
|
yield return new WaitForSeconds(5f);
|
|
_pool.Return(particles);
|
|
}
|
|
}
|