Scriptable Objects inside other SO's not loading properly from Asset Bundle
tl;dr: I've got a custom Scriptable Object that holds other scriptable objects inside of it. When I try and load the asset, the top level object loads fine but all other SO's inside are null.
Here's a few of the objects' code:
[Serializable]
public class ST_Map : ScriptableObject
{
public int Height;
public int Width;
public int TileWidth;
public int TileHeight;
public string MapName;
[SerializeField]
public PropertyDictionary Properties;
public List<STM_LayerData> Layers;
public List<STM_TilesetData> Tilesets;
}
[Serializable]
public class STM_LayerData : ScriptableObject
{
public string Name;
[SerializeField]
public PropertyDictionary Properties;
public List<STM_LayerTileData> Tiles;
}
[Serializable]
public class STM_LayerTileData : ScriptableObject
{
public int Gid;
public int X;
public int Y;
public bool HorizontalFlipped;
public bool VerticalFlipped;
public bool DiagonalFlipped;
}
Now when I load the ST_Map asset from the AssetBundle, I'll get this, which appears to be correct complete data:
However on further inspection of the other objects, I'm getting this:
I'm really not sure what's going wrong. All dependencies are loaded in, I've tried marking every field with [SerializeField] on the SO code, I'm honestly at a loss.
Also just for more info, the secondary objects are added to the same .asset file in this structure
Answer by Akihiko · Sep 13, 2017 at 12:00 AM
Fixed it. Turned out the issue was because I kept all of the Scriptable Objects in the same file, each needs its own .cs file for it to work.
Your answer
Follow this Question
Related Questions
IComparable for different scriptable objects 0 Answers
Assign ScriptableObject (Inventory DataBase) 0 Answers
Scriptable Objects and Assetbundles 0 Answers
Help with a C# script .SetActive 1 Answer