Live Paint

Live Paint (at runtime) into a Particle Playground system can be done by a simple script. This video guide walks you through how to create painted birth positions for particles using raycasts from the camera onto any colliders within the scene.

Paint with Physics.Raycast (requires 3d colliders within the scene):

using UnityEngine;
using System.Collections;
using ParticlePlayground;

public class PaintAtRaycastPosition : MonoBehaviour {

    PlaygroundParticlesC particles;
    Camera cam;

    void Start () 
    {
        particles = GetComponent<PlaygroundParticlesC>();
        cam = Camera.main;
    }
    
    void Update () 
    {
        if (Input.GetMouseButtonDown(0))
            PaintRaycast ();
    }

    void PaintRaycast ()
    {
        Ray ray = cam.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;
        if (Physics.Raycast (rayout hit))
        {
            PlaygroundC.Paint (particleshit.pointhit.normalhit.transformColor.white);
        }
    }
}

Paint with Physics2D.Raycast (requires an orthographic camera and 2d colliders within the scene):

using UnityEngine;
using System.Collections;
using ParticlePlayground;

public class PaintAtRaycast2dPosition : MonoBehaviour {
    
    PlaygroundParticlesC particles;
    Camera cam;
    
    void Start () 
    {
        particles = GetComponent<PlaygroundParticlesC>();
        cam = Camera.main;
    }
    
    void Update () 
    {
        if (Input.GetMouseButtonDown(0))
            PaintRaycast ();
    }
    
    void PaintRaycast ()
    {
        Vector2 mouseToWorldPos = cam.ScreenToWorldPoint(Input.mousePosition);
        RaycastHit2D hit = Physics2D.Raycast (mouseToWorldPosVector2.zero);
        if (hit.collider!=null)
        {
            PlaygroundC.Paint (particleshit.pointhit.normalhit.transformColor.white);
        }
    }
}