ScriptableObject losing data in AssetBundle

I’m using Unity 2018.6.3

I have a ScriptableObject and I placed instances of it into an AssetBundle. The issue I have is that it loses all data except its name string.

Here’s a simple version of what I’m trying to do:

public class MyScriptableObject : ScriptableObject
{
         public string Name; // this data remains fine
         public GameObject Item; //this data is lost when AssetBundles are built
         public List<ItemHolder> = new List<ItemHolder>(); //contents of this list is also lost
 }

[Serializable]
public class ItemHolder
{
        public string ItemName;
        public GameObject SecondItem;
}

When I load an instance of this ScriptableObject from the AssetBundle, the Name string comes back, but all the other references are lost.
The scriptable object asset and the prefab are inside the AssetBundle.

Is there something I’m doing wrong?

I’ve discovered an answer to this.

It turns out, that the container classes needed converting to structs. The scriptableObject can serialise classes, but the asset bundle builder seems unable to. If there is some documentation that explains this, I’d love to read it.

What exact objects do you have referenced from your scriptableobject? Are you sure the assets you reference are actually there when you load your bundle? Keep in mind if you reference ordinary asset from the actual project, this might fail if those aren’t included in the build. Usually you want to have an assetbundle to contain all dependencies in one bundle. However an AssetBundle can have dependencies on other bundles. Though those need to be loaded before the actual bundle.

Have a look at assetbundle dependencies.

@Bunny83 It seems to be losing everything except for simple data types. I have some classes that contain only a string and an int (no dependencies required). The instances of these are also lost when I attempt to retrieve the scriptableObject from the asset bundle. They were serialised correctly in the scriptableObject before I built the asset bundle