I am working on a script with C# and whenever I run my game, console pops up and says "Object reference not set to an instance of an object. Then when I click it to try and solve the problem, it brings me to this point in my script and I can't figure out what to do...
//Add spheres that can be collided against
GameObject[] sp2 = GameObject.FindGameObjectsWithTag ("Softbody");
Object[] objs = GameObject.FindObjectsOfType(typeof(GameObject));
allSpheres = new ArrayList();
int cnt=0;
for(int i=0;i<sp2.Length;i++) {
allSpheres.Add(sp2*);*
*cnt++;*
*}*
*for(int i=0;i<objs.Length;i++)*
*{*
_if(objs*.name == "SphereSoft") {*_
<em>_allSpheres.Add(objs*);*_</em>
<em>_*cnt++;*_</em>
<em>_*}*_</em>
<em>_*}*_</em>
<em>_*```*_</em>
<em>_*<p>Could someone help me out? I will be continuously trying to find my answer on the Unity website.</p>*_</em>