Unity Particles

Written by Jodi Cheung

Collider Example

Object should have Throwable and Interactable scripts, and a collider.

Particle System
Create particle system: GameObject->Effects->Particle System

Drag the particle to be the child of the object in the Hierarchy

Select the Particle, in the Inspector uncheck Play On Awake.

Add script
Select object in the Hierarchy
Select the Add Component button in the Inspector
     Scroll down to New script
          Type the name: TriggerParticles
          Double click the C# script in your Assets folder

Replace the entire script with this:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TriggerParticles : MonoBehaviour

    public ParticleSystem particles;
    public GameObject objectToCollideWith;
    public float timer;
    private void Start()
        if (particles == null)
            particles = GetComponentInChildren<ParticleSystem>();
    private void OnCollisionEnter(Collision collision)
        if (collision.gameObject == objectToCollideWith)
        else if (objectToCollideWith == null)
    IEnumerator Countdown()
        yield return new WaitForSeconds(timer);

Adjust the Variables for the Script
Select your object in the Hierarchy

Add these options under the TriggerParticles script in the Inspector
     Drag the particles from the Hierarchy into Particles field
     (If none are input, it will assume the particles are a child of this gameobject.)
     Add an Object to Collide With, otherwise anything with a collider will start the particles.
     Input a value for Timer.    How long the particle system should play in seconds.

Particle Examples from Unity
Create a new project, do not import into your current project.

Download package from Unity Asset Store
     Click Add to my Assets
     Click Open in Unity
Window->Package Manager
     Packages: My Assets
          Look for Unity Particle Pack

This installed a few folders into your Assets folder:
     EffectExamples, some more Scenes, Shared, TextMesh Pro, TutorialInfo

Some WebGL publish settings are changed after installing this package, you may need to fix:
Edit->Project Settings...
  Select Player
     Under Other Settings
          Select Color Space to Gamma   (default Linear)
          Make sure Auto Graphics API is selected (default selected)
          Change Lightmap Encoding
to Normal Quality   (default High Quality)
     Under Publishing Settings
          Change Compression Format  to Disabled  (default Gzip)

SteamVR Errors:
Visible in Background (current = False)   wants True
GPU Skinning (current = False)   wants True

© 1988-2022 34 years Jennifer Steinkamp