- Home /
Question by
JollyJenkins · May 03, 2012 at 05:55 AM ·
particles
Particle Effect Not Showing
I written a simple script that uses the particle system to construct a line of particles.
//4/30/2012, 25 minutes before the first morn of May using UnityEngine;
public class Grapher1 : MonoBehaviour {
//particles need a resolution, we set the default to 10
public int resolution = 10;
private ParticleSystem.Particle[] points;
// Use this for initialization
void Start () {
//the resolution is assigned in the start method, so the code can fire instantly before updates start running
points = new ParticleSystem.Particle[resolution];
float increment = 1 / (resolution - 1);
for(int i = 0; i < resolution; i++){
float x = i * increment;
points[i].position = new Vector3(x,0f,0f);
points[i].color = new Color(x,0f,0f);
points[i].size = 0.1f;
}
}
// Update is called once per frame
void Update () {
//particles need to be fed into the particle system through the particleSystem component
particleSystem.SetParticles(points, points.Length);
}
}
But for some reason I can't figure out, the particles fail to show up when I run the game, even though this code compiles perfectly. I have the camera setup to view the object assigned with this script.
Comment
Your answer
Follow this Question
Related Questions
dust in a light effect 0 Answers
Eliminate particle flicker 1 Answer
How do I Update the transform of Instantiate prefab? 2 Answers
particle system 0 Answers
How to change particles' view? 2 Answers