1

I am trying to build the following structure into the Unity inspector so I can add the necessary Sprites and AudioClips. I can build a simple ArrayList but not sure how to build with different levels.

Letters (size 28)

letter[0] {
    mainSprite {Sprite},
    letterSounds[3](size 3) { Sprite, Audioclip}, { Sprite, Audioclip}, { Sprite, Audioclip},
    animation {Animation}

letter[1] {
    mainSprite {Sprite},
    letterSounds[3](size 3) { Sprite, Audioclip}, { Sprite, Audioclip}, { Sprite, Audioclip},
    animation {Animation}

letter[2] {
    mainSprite {Sprite},
    letterSounds[3](size 3) { Sprite, Audioclip}, { Sprite, Audioclip}, { Sprite, Audioclip},
    animation {Animation}

This is what I have. But it is only one level. I have looked at tutorials but they only show add the depth in code. I want to add it to the Unity [SerializeField] inspector

[System.Serializable]
public class Point
{
   public List<Vector3> list;
   public Point()
   {
      list = new List<Vector3>();
    }
}

public class AlphaIntroController : MonoBehaviour {

    [SerializeField]
    public List<GameObject> myLists = new List<GameObject>();

1 Answer 1

1

I'm not entirely sure what it is you want but I followed your Letters structure to produce this in the inspector:

using System;
using System.Collections.Generic;
using UnityEngine;

[Serializable]
public class Letter
{
    [Serializable]
    public struct LetterSounds
    {
        public Sprite sprite;
        public AudioClip audioClip;
    }

    public Sprite mainSprite;
    public List<LetterSounds> letterSounds = new List<LetterSounds>();
    public Animation animation;
}

public class AlphaIntroController : MonoBehaviour 
{
    public List<Letter> letters = new List<Letter>();
}

Letters structure

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.