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?
__```**__