I’ve created the following struct
struct Sounds
{
public AudioClip MainEngine;
public AudioClip LevelComplete;
public AudioClip Death;
public AudioClip BonusItem;
public void AssignSounds(AudioClip[] sounds)
{
MainEngine=sounds[0];
LevelComplete= sounds[1];
Death= sounds[2];
BonusItem= sounds[3];
}
}
I would like to expose the variables on the inspector and do away with the AudioClip and construcctor so that the struct is constructed on the inspector.
What I’ve Tried
[SerializedField] Sounds sounds;
[SerializedField] struct Sounds {...}
struct Sounds
{
[SerializedField] AudioClip MainEngine;
[SerializedField] AudioClip LevelComplete;
[SerializedField] AudioClip Death;
[SerializedField] AudioClip BonusItem;
}
What I Hoped for was to see the variables displayed on the inspector similar to how an Array is displayed. What I got was “nothing”.
I apparently don’t even know how to ask the search engine to find the right scripting reference as it came back with
If someone could point me towards the answer I’d appreciate it.