# Move Particles

I cant figure out how to make my particles move with velocity.

tried a few things but none worked. and i dont understand the function get particles.

using UnityEngine;
using System.Collections;

public class SunPhotons : MonoBehaviour {

public int InitSpeed=75;

int j=0;

public int NumberOfParticles=100;

private ParticleSystem.Particle[] Photons;
private ParticleSystem.Particle[] Photons2;

bool isInitializedPosition=false;
Vector3 LocationForDebug = new Vector3(0,0,0);
Vector3 SpeedForDebug = new Vector3 (10,10,10);

void Start () {

Photons = new ParticleSystem.Particle[NumberOfParticles];

}

// Update is called once per frame
void LateUpdate () {
int i;
ParticleSystem SunRay = GameObject.Find("SunRay").GetComponent<ParticleSystem>();
for ( i = 0; i < NumberOfParticles; i++)
{
if (!isInitializedPosition)
{
Photons*.position=LocationForDebug;*

_ Photons*.color=new Color(10,0,0);_
Photons.size=0.2f;*_

* }*
_ Photons*.velocity=SpeedForDebug;
Photons.angularVelocity=0.4f;*_

_ // Photons*.position= new Vector3((i+j)/100f,0,0);
particleSystem.SetParticles(Photons,NumberOfParticles);*_

* }*
* particleSystem.SetParticles(Photons,NumberOfParticles);*
* j++;*

* GameObject.Find(“SunRay”).GetComponent().GetParticles(Photons2);*
* isInitializedPosition=true;*
* }*
}

First, using Find(name) twice per frame to get the same gameobject is a bad idea. Do it once in Start.

Also, unless the system is emitting parcticles continuously, you don’t need to get the particles each frame, only once. But you do need to Set them to commit the modifications. Not in the for loop, mind you.

Once this is fixed, you should see things more clearly.