Error when trying to save inventory with array.

I am using unifycommunity.com
to save and load.

i have an inventory with array.
That is class that contains items vars.
This form Inv_Inventory from Player:

class InventoryItem
{

    var worldObject: GameObject;
    var itemIcon: Texture;
    var itemName : String;
    var itemDescription : String;
    var Stack : int;
    var MaxStack : int;

}

This From SaveLoad:

 if (GUI.Button(_Save,"Save")) {
            
      GUI.Label(_SaveMSG,"Saving to: "+_FileLocation);
      //Debug.Log("SaveLoadXML: sanity check:"+ _Player.transform.position.x);
      var plr = gameObject.Find("Player");
var invScrpt = plr.GetComponent(Inv_Inventory);

      myData._iUser.x = _Player.transform.position.x;
      myData._iUser.y = _Player.transform.position.y;
      myData._iUser.z = _Player.transform.position.z;
      myData._iUser.name = _PlayerName;   
	  
	    for( var j = 0; j < myData._iUser.inventory.length; j ++ )
    {
        for( var s = 0; s < myData._iUser.inventory[j].length; s ++ )
        {
	  
	  for( var i = 0; i < invScrpt.inventory.length; i ++ )
    {
        for( var k = 0; k < invScrpt.inventory*.length; k ++ )*

{
_ if (invScrpt.inventory*[k] != null)_
_
{_
myData._iUser.inventory[j] ~~= invScrpt.inventory[k];
_
}
}
}
}
}
// Time to creat our XML!_
data = SerializeObject(myData);*~~
// This is the final resulting XML from the serialization process
CreateXML();
Debug.Log(_data);
}
Like That i am trying to save Inventory Array to file.
But when i click save and have item in inventory i have this error.
InvalidOperationException: The type of the argument object ‘Inv_Inventory.InventoryItem’ is not primitive.
Help me plz guys. I don’t know what to do._

You can only serialize primitive types directly. If you are not using Primitive types you should implement the ISerializable attribute with the methods used for serialization.

Have a look at the ISerilizable docs to understand this a bit better:

In you code the InventoryItem class is not serializable. And some of the members of the class are not either (GameObject or Texture)