Script Reference

Get to know Particle Playground from the inside. The Script Reference provides detailed information of how everything connects where you can read up on the available classes, functions and variables.

Getting started

Once Particle Playground is imported into your Unity project you’ll get started through the home screen ”Playground Wizard”. You can find it in Window > Particle Playground. From here you can create new Particle Playground systems, manage your Presets and configure your Playground. See the Getting Started video for a basic introduction.

The Particle Playground systems are all driven by a Playground Manager, this will instantiate automatically if you don’t already have one in your scene upon creation. Note: There should always only be one Playground Manager in your scene.

Scripting

Particle Playground is entirely written in C# with all source code available. To create a new Particle Playground system through script you can use the PlaygroundC class and the wrapper function Particle() which will return a PlaygroundParticlesC object.

Instantiate a new Particle Playground system:

PlaygroundParticlesC particles = PlaygroundC.Particle();

Instantiate a previously created Preset:

PlaygroundParticlesC particlePreset = PlaygroundC.InstantiatePreset("Name");

Make sure you use the namespace ParticlePlayground at the top of your document. For examples on how to access and control Particle Playground systems through script, please see the Simple Scripts library, the Example Project and the Example Scenes provided with the package.

Scripted Emission

Not to be confused with scripting towards a Particle Playground system, you can control the created birth positions (Source) by calling Emit() from script. This will make the Source be automatically set to Script mode, where certain options connected to Source functionality (such as Source Scatter and Lifetime Sorting)  no longer will be available.

Example:

using UnityEngine;
using System.Collections;
using ParticlePlayground;

public class EmitExample : MonoBehaviour {
    IEnumerator Start () {
        PlaygroundParticlesC particles = GetComponent<PlaygroundParticlesC>();
        Vector3 position = Vector3.zero;
        Vector3 velocity = Vector3.up;
        float lifetime = 10f;
        Color32 color = Color.white;
        
        while (!particles.IsReady())
            yield return null;
        
        particles.Emit (positionvelocitylifetimecolor);
    }
}

Documentation

The documentation of Particle Playground is available in different formats for your needs.