Quantcast
Channel: Answers for "Instantiate prefab and Add to a Generic List"
Viewing all articles
Browse latest Browse all 4

Answer by Fornoreason1000

$
0
0
there are many things that could be going wrong here for example: impactDecalsContainer is null; making impactDecalsList null; remember your using a List, not an array. I've managed to duplicate you error and allImpactDecals.Length is returning null, that's the problem. Null Reference means something is Null and your trying to do something with it when you obviously can't. (I don't recall Length being in List it used it be Count, maybes its a Mono thing). anyway... when using Count instead of length, the Null ref up and leaves. why it didnt call a "No method" error instead is new to me. impactDecalsList.allImpactDecals.Count // returns number of items heres an insight on List, its all in C#,C++ and VB but you get the idea http://msdn.microsoft.com/en-us/library/6sh2ey19.aspx#inheritanceContinued

Viewing all articles
Browse latest Browse all 4

Trending Articles