So...
I was watching some old unity tutorial videos and saw people editing properties of the elements of an array in editor like this:
When I tried in my project the editor does not showed the properties, just show a place to select an already created element:
Why the "Clip", "Volume" and "Name" properties are missing when I do it in my project?
My classes:
using UnityEngine;
public class AudioManager : MonoBehaviour
{
[SerializeField]
public Sound[] Sounds;
}
[System.Serializable]
public class Sound : MonoBehaviour
{
public AudioClip Clip;
public string Name;
[Range(0f, 1f)]
public float Volume;
[Range(.1f, 3f)]
public float Pitch;
}
I'm using Unity 2021.3.5f1
CodePudding user response:
The problem is that your Sound class inherits from Object (MonoBehaviour), and Object are always serialized as reference. Make your Sound not inherit MonoBehaviour and it should look like in example (except that you have newer version of unity with reorderable list drawer)