1

So...

I was watching some old unity tutorial videos and saw people editing properties of the elements of an array in editor like this:

enter image description here

When I tried in my project the editor does not showed the properties, just show a place to select an already created element:

enter image description here

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

1 Answer 1

1

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)

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

1 Comment

It was it! I totally miss out this... Thank you @paweł-Łęgowski .

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.