Skip to main content
edited tags
Link
DMGregory
  • 140.8k
  • 23
  • 257
  • 401
edited title
Source Link
kanamekun
  • 379
  • 6
  • 23

Viewing Wrapper/Container Classes infrom a Scriptable Object inside of the Unity Inspector

It's working great, butand I can view and edit data in the Scriptable Objects perfectly.

enter image description here

But when I try to pull data from the Scriptable Object into Scene variables... I can't see them in the graph's Inspector.

Viewing Wrapper/Container Classes in a Scriptable Object inside of the Unity Inspector

It's working great, but when I pull data from the Scriptable Object into Scene variables... I can't see them in the graph's Inspector.

Viewing Wrapper/Container Classes from a Scriptable Object inside of the Unity Inspector

It's working great, and I can view and edit data in the Scriptable Objects perfectly.

enter image description here

But when I try to pull data from the Scriptable Object into Scene variables... I can't see them in the graph's Inspector.

Source Link
kanamekun
  • 379
  • 6
  • 23

Viewing Wrapper/Container Classes in a Scriptable Object inside of the Unity Inspector

I'm making a word game to teach kids how to read and promote literacy. As part of that, I made a Scriptable Object that's basically a bunch of nested Lists, until it reaches the bottom node:

using System.Collections.Generic;
using UnityEngine;
using Unity.VisualScripting;
 
[CreateAssetMenu(fileName = "New WordPronunciationData", menuName = "Word Pronunciation Data", order = 51)]
 
public class WordPronunciationData : ScriptableObject
{
 
    [System.Serializable]
 
    [IncludeInSettings(true)]
        public class NeemUnitContainer {
        public List<NeemUnit> NeemUnitContainers;
}
 
    [System.Serializable]
 
    [IncludeInSettings(true)]
        public class Syllable {
        public List<NeemUnitContainer> Syllables;
}
 
    [System.Serializable]
 
    [IncludeInSettings(true)]
    public class NeemUnit {
        [SerializeField]
        public List<FlexNeem> individualNeem;
         
    }
 
    [System.Serializable]
 
    [IncludeInSettings(true)]
    public class FlexNeem{
        [SerializeField]
        public NeemData superNeem;
     
        [SerializeField]
        public FeemData Feem;
 
    }
 
    [System.Serializable]
 
    [IncludeInSettings(true)]
    public class CompleteWordList{        
            public List<Syllable> completeWord;
    }
    public List<CompleteWordList> allWords;
 
}

It's working great, but when I pull data from the Scriptable Object into Scene variables... I can't see them in the graph's Inspector.

enter image description here

However for the bottom node in my Scriptable Object... I defined the class as calling 2 other Scriptable Objects:

    [System.Serializable]
 
    [IncludeInSettings(true)]
    public class FlexNeem{
        [SerializeField]
        public NeemData superNeem;
     
        [SerializeField]
        public FeemData Feem;
 
    }

And when I create a variable and put data from these into them, they do show up very nicely in the Inspector.

enter image description here

But somehow when I make a container/wrapper class around this to make a List, and then put that data into a variable... it no longer shows up in a Inspector containing that variable.

enter image description here

This is making debugging much harder. I can only see how many items are in the list, not what the item is.

Is this just the nature of creating so many wrapper/container classes with lists? Is there a way I could view the wrapper/container classes in the Inspector, rather than just seeing "No Inspector For..."?

If anyone has tips or advice, I would greatly appreciate it! Thank you!!