- Home /
Question by
shongololo · Jun 08, 2015 at 08:46 AM ·
unity5particlesystemcullingfrustum
frustum culling hides particle system when origin off screen
I am trying to assign points to a particle system in a script. However, when doing so, once the origin point of the particle system is off screen, then all of the child particles disappear from view.
Is there a way to remedy this? The following script is attached to a game object with an attached particle system. The particle system has everything deactivated except for the renderer. The play on awake option is also unchecked. The particles are visible as long as the origin point is in the screen, otherwise, not.
using UnityEngine;
public class ParticleMap : MonoBehaviour
{
public int resolution = 10;
private ParticleSystem particle_system;
private ParticleSystem.Particle[] points;
void Start ()
{
particle_system = GetComponent<ParticleSystem> ();
points = new ParticleSystem.Particle[resolution * resolution];
float increment = 1f / (resolution - 1);
int i = 0;
for (int x = 0; x < resolution; x++) {
for (int z = 0; z < resolution; z++) {
Vector3 p = new Vector3 (x * increment, 0f, z * increment);
points [i].position = p;
points [i].color = new Color (p.x, 0f, p.z);
points [i].size = 10;
i++;
}
}
particle_system.SetParticles (points, points.Length);
}
}
Comment