I created three Scriptable Objects for my Unity word game:
- FeemData - This is to hold information on letters
- NeemData - This is to hold information on pronunciation
- SuperNeemData - This is to hold #1 and #2 together in a single Scriptable Object.
Here's the C# code for the SuperNeemData SO:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(fileName = "New SuperNeemData", menuName = "Super Neem Data", order = 51)]
public class SuperNeemData : ScriptableObject
{
[SerializeField]
public FeemData actualFeem;
[SerializeField]
public NeemData superNeem;
}
So far, so good. But then I created a LevelData, which is meant to hold an arbitrary number of SuperNeemDatas:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(fileName = "New LevelData", menuName = "Level Data", order = 51)]
public class LevelData : ScriptableObject
{
[SerializeField]
public List<SuperNeemData> SuperNeemForThisLevel;
}
When I go to the Inspector allows me to view and change the SuperNeemDatas in there, like this:
This works OK, but it's not the best workflow. In order to create a SuperNeemData, first I have to go into a separate folder and generate a SuperNeemData Scriptable Object and then drag the FeemData into there... and then drag a NeemData into there... and then go back to LevelData and drag the SuperNeemData Scriptable Object into there.
The whole process takes a lot of extra time and clicks. I'm hoping to change things so that I can drag FeemData and NeemData Scriptable Objects directly into the LevelData Scriptable Object.
In short (I think), I would like the LevelData Scriptable Object to have a List of an Array (with two items: first one is a FeemData and second one is a NeemData). Then if I am understanding things correctly, I could drag a FeemData So and a NeemData SO directly into the LevelData SO... a much easier workflow.
Any advice on how to structure a Scriptable Object so that it has a List of an Array of 2 other Scriptable Objects? Thank you!