Why i can't read a Variable's Length(Array)

I have been disappointed in using this for alot of times:

@script AddComponentMenu("Utility/Customization System")
@script ExecuteInEditMode()
public var executeInEditMode : boolean = false;
public var customizationMeshes : CustomizationMeshes[];
public class CustomizationMeshes {public var CustomizationID : int = 0;public var meshGroups : MeshGroups[];}
public class MeshGroups {public var SingleMeshes : GameObject[];public var GroupMeshes : GameObject;}
public function Update ()
{
	if(executeInEditMode || !executeInEditMode && Application.isPlaying)
	{
		for(var a : int = 0; a < customizationMeshes.Length; a++)for(var b : int = 0; b < customizationMeshes[a].meshGroups.Length; b++)for(var c : int = 0; c < customizationMeshes[a].meshGroups**.SingleMeshes.Length; c++)**

** {**
__ customizationMeshes[a].CustomizationID = Mathf.Clamp(customizationMeshes[a].CustomizationID,0,customizationMeshes[a].meshGroups**.Length);__
__
if(customizationMeshes[a].CustomizationID == 0)__
__
{__
__ if(customizationMeshes[a].meshGroups.SingleMeshes**
```c__

)customizationMeshes[a].meshGroups.SingleMeshes[c].SetActive(false);
if(customizationMeshes[a].meshGroups**.GroupMeshes)customizationMeshes[a].meshGroups**.GroupMeshes.SetActive(false);
}
if(customizationMeshes[a].CustomizationID > 0)
{
if(customizationMeshes[a].CustomizationID - 1 != b)
{
if(customizationMeshes[a].meshGroups**.SingleMeshes[c])customizationMeshes[a].meshGroups**.SingleMeshes[c].SetActive(false);
if(customizationMeshes[a].meshGroups**.GroupMeshes)customizationMeshes[a].meshGroups**.GroupMeshes.SetActive(false);
}
if(customizationMeshes[a].CustomizationID - 1 == b)
{
if(customizationMeshes[a].meshGroups**.SingleMeshes[c])customizationMeshes[a].meshGroups**.SingleMeshes[c].SetActive(true);
if(customizationMeshes[a].meshGroups**.GroupMeshes)customizationMeshes[a].meshGroups**.GroupMeshes.SetActive(true);
}
}
}
}
}

it always sends an error message and doesn’t work:
NullReferenceException: Object reference not set to an instance of an object. in line 13 (when clamping customizationID)
can someone help me with this?

__```**__

This code is really weird. On line 13, we have

customizationMeshes[a].meshGroups**.Length**

which should cause a compilation error before anything. You should always add
#pragma strict
to the beginning of all UnityScripts, or switch to C#, then you’d probably get different error messages.
The thing with this line is that customizationMeshes[a] is a “CustomizationMeshes” object.
So customizationMeshes[a].meshGroups** is a “MeshGroups” object. The class “MeshGroups” does not have a variable named “Length”, so this line wouldn’t even compile with #pragma strict.**
You should perhaps fix this kind error (with #pragma strict, the compiler will help you finde them), use some more local variables to increase readabilty of your code and then have a look at it again.

myVar is declared as a float array in your script, but doesn’t yet have a value, which causes the interpreter to throw a NullReferenceException. In C#, the initializer is

float[] myVar = float[arraySize];  

Where arraySize is a literal integral value. Looks like Unity Technologies added a way to make JS less inferior, so you can initialize the array with

myVar = new float[arraySize];

again, where arraySize is a literal integral value. It appears you can’t declare and initialize on the same line.