/// <summary> /// Spawns the particles at the given location. /// </summary> /// <param name="parent">The parent actor (can be null to link it to the first loaded scene).</param> /// <param name="transform">The spawn transform.</param> /// <param name="autoDestroy">If set to <c>true</c> effect be be auto-destroyed after duration.</param> /// <returns>The spawned effect.</returns> public ParticleEffect Spawn(Actor parent, Transform transform, bool autoDestroy = false) { if (WaitForLoaded()) { throw new Exception("Failed to load " + ToString() + '.'); } var effect = ParticleEffect.New(); effect.Transform = transform; effect.ParticleSystem = this; SceneManager.SpawnActor(effect, parent); if (autoDestroy) { Destroy(effect, Duration); } return(effect); }