I have a basic raycaster and particle spawner at the raycast. It instantiates just fine, but the clones don’t delete, even if the particlesystem prefab has the “destroy on completion” checked.
[SerializeField]
ParticleSystem particles;
Quaternion playerRotation;
if(Physics.Raycast(gunRay, out RaycastHit hitInfo))
{
hitObject = hitInfo.transform.gameObject;
Debug.Log(hitObject.name);
Destroy(Instantiate(particles, hitInfo.point, playerRotation), 0.15f);
}
I tried to make the particles a prefab instead of just a GameObject
, which would allow it to still be copied after being destroyed. That didn’t do anything.