I'm still new to C, and am probably missing something basic.
I have this script that keeps giving me this error:
NullReferenceException: Object reference not set to an instance of an object
ParticleCollide.OnParticleCollision (UnityEngine.GameObject other) (at Assets/Scripts/ParticleCollide.cs:35)
It compiles, and lets me run it, but everytime a collision occurs, I get the error above. I Bolded line 35 that's throwing the error.
using UnityEngine;
using System.Collections;
public class ParticleCollide : MonoBehaviour {
public ParticleSystem ps;
GameObject GC;
void Start () {
GC = GameObject.Find ("GrabberCube");
ps = GetComponent();
}
void OnParticleCollision(GameObject other){
ParticleSystem.Particle[] particles = new ParticleSystem.Particle[ps.particleCount];
int num = ps.GetParticles (particles);
//Debug.Log("found "+num+"of particles");
for (int i=0; i
↧