Thursday, July 7, 2022
HomeGame Developmentunity - Structuring a Scriptable Object in order that it has a...

unity – Structuring a Scriptable Object in order that it has a Checklist of an Array of two different Scriptable Objects


I created three Scriptable Objects for my Unity phrase sport:

  1. FeemData – That is to carry info on letters
  2. NeemData – That is to carry info on pronunciation
  3. SuperNeemData – That is to carry #1 and #2 collectively in a single Scriptable Object.

Here is the C# code for the SuperNeemData SO:

utilizing System.Collections;
utilizing System.Collections.Generic;
utilizing UnityEngine;

[CreateAssetMenu(fileName = "New SuperNeemData", menuName = "Super Neem Data", order = 51)]

public class SuperNeemData : ScriptableObject
{
    [SerializeField]
    public FeemData actualFeem;

    [SerializeField]
    public NeemData superNeem;

}

To this point, so good. However then I created a LevelData, which is supposed to carry an arbitrary variety of SuperNeemDatas:

utilizing System.Collections;
utilizing System.Collections.Generic;
utilizing UnityEngine;

[CreateAssetMenu(fileName = "New LevelData", menuName = "Level Data", order = 51)]

public class LevelData : ScriptableObject
{
    [SerializeField]
    public Checklist<SuperNeemData> SuperNeemForThisLevel;

}

After I go to the Inspector permits me to view and alter the SuperNeemDatas in there, like this:

enter image description here

This works OK, however it’s not the very best workflow. With a view to create a SuperNeemData, first I’ve to enter a separate folder and generate a SuperNeemData Scriptable Object after which drag the FeemData into there… after which drag a NeemData into there… after which return to LevelData and drag the SuperNeemData Scriptable Object into there.

The entire course of takes lots of further time and clicks. I am hoping to alter issues in order that I can drag FeemData and NeemData Scriptable Objects instantly into the LevelData Scriptable Object.

Briefly (I feel), I would really like the LevelData Scriptable Object to have a Checklist of an Array (with two objects: first one is a FeemData and second one is a NeemData). Then if I’m understanding issues appropriately, I might drag a FeemData So and a NeemData SO instantly into the LevelData SO… a a lot simpler workflow.

Any recommendation on easy methods to construction a Scriptable Object in order that it has a Checklist of an Array of two different Scriptable Objects? Thanks!

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments