I use a particle system for a rain effect. What I want is when a single particle collides with my floor, a good effect spawns at the position. I attached this script to the floor.
numCollisionEvents is always 0. I have no idea what is going on. oh…!
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class rainEffect_floor : MonoBehaviour
{
public GameObject effect;
public ParticleSystem ps;
public List collisionEvents;
void Start()
{
collisionEvents = new List();
}
void OnParticleCollision(GameObject other)
{
int numCollisionEvents = ps.GetCollisionEvents(other, collisionEvents);
Debug.Log(numCollisionEvents);
for (int i = 0; i < numCollisionEvents; i++)
{
Instantiate(effect, collisionEvents*.intersection, Quaternion.identity);*
}
}
}