Hello
I am trying to create a star field and set the particles to my world after creating an array of stars. But i get an error:
An object reference is required to access non-static member `UnityEngine.ParticleSystem.SetParticles(UnityEngine.ParticleSystem.Particle[], int)`
I don’t quite know what my mistake was. Am hoping some one could help explain. My script is this:
using UnityEngine;
using System.Collections;
public class Stars : MonoBehaviour {
public int maxStars = 1000;
public int universeSize = 10;
private ParticleSystem.Particle[] points;
private void Create(){
points = new ParticleSystem.Particle[maxStars];
for (int i = 0; i < maxStars; i++) {
points_.position = Random.insideUnitSphere * universeSize;_
_ points*.startSize = Random.Range (0.05f, 0.05f);_
_ points.startColor = new Color (1, 1, 1, 1);
}*_
* }*
* void Start() {*
* Create ();*
* }*
* // Update is called once per frame*
* void Update () {*
* if (points != null) {*
* ParticleSystem.SetParticles (points, points.Length); //ERROR here*
* }*
* }*
}
I am using unity version 5.