Search Unity

Show nested ScriptableObject in Inspector

Discussion in 'Editor & General Support' started by bolska, Apr 27, 2019.

  1. bolska

    bolska

    Joined:
    Jul 19, 2018
    Posts:
    8
    I`m new to Unity and i want to know if it`s possible to show nested ScriptableObject (SO) in Inspector. I want to click at the NPCSettings Asset and show all nested SO in the inspector, so that i can everything in one asset.
    Is it possible to do that?

    For example, i have 4 SO`s that are linked together:

    Code (CSharp):
    1. public class NPCSettings : ScriptableObject
    2. {
    3.     public Status status;
    4.     public Task[] tasks;
    5. }
    Code (CSharp):
    1. public class Task : ScriptableObject
    2. {
    3.     public float startTime;
    4.     public float endTime;
    5.  
    6.     public TaskType type;
    7.     public Routine routine;
    8.  
    9.     public bool isInterferenceTask;
    10. }
    Code (CSharp):
    1. public abstract class Routine : ScriptableObject
    2. {
    3.     public AnimatorStateController animatorStateController;
    4.  
    5.     public abstract void ExecuteRoutine(Animator animator);
    6.     public abstract bool HasRoutineFinished();
    7. }
    Code (CSharp):
    1. public class Status : ScriptableObject
    2. {
    3.    //Lots of Attributes
    4. }
     
  2. hsjaaa

    hsjaaa

    Joined:
    Apr 30, 2016
    Posts:
    29
  3. jankovalsky

    jankovalsky

    Joined:
    May 31, 2017
    Posts:
    14
    You can make those vanilla classes instead ScriptableObject and give them attribute [System.Serializable]
     
    timoniann likes this.