I have a big amount of prefabs. Those prefabs have several instances of the same script, which contains the following fields:
[SerializeField]
private AudioClip[] _audioClip;
[SerializeField, Range(0, 1)]
private float _volume = 1;
Since I would like to be able to control the volume of each audio clip separately, I would like to use:
[SerializeField]
private VolumedAudioClip[] _audioClips;
Where:
[Serializable]
public class VolumedAudioClip
{
[SerializeField]
public AudioClip _audioClip;
[SerializeField, Range(0, 1)]
public float _volume = 1;
}
Problem is, that if I change it now, all of the prefabs will lose the references to the audio clips already set.
I know of FormerlySerializedAs
attribute, it doesn't help in my case (only if you rename a field).
My current direction is to write an editor script that will read from the old fields and put the data in the new fields.
Would be happy to hear any better suggestions...