Reputation: 14151
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>();
Upvotes: 1
Views: 1074
Reputation: 1827
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>();
}
Upvotes: 1