- Home /
How do I get to the AudioMixerSnapshots of a cloned AudioMixer?
When I apply AudioMixer.FindSnapshot() to a cloned AudioMixer, it wil return the Snapshots of the original AudioMixer rather than the cloned one.
I want to interpolate the Snapshots of the cloned AudioMixer using AudioMixer.TransitionToSnapshots(), but I can't get a reference to the cloned AudioMixer's Snapshots.
Does anybody have any ideas as to how to solve this? Any help is very, very much appreciated! Here's a simple test project illustrating the problem: https://drive.google.com/file/d/0B4PGrnbx86xCR3hkM1FSc29wQ3c/view?usp=sharing
Here's some code:
using System.Collections;
public class Cloning_Problem : MonoBehaviour
{
public AudioMixer _AudioMixer;
public AudioMixer _AudioMixer_Clone;
public AudioMixerSnapshot[] _Snapshot;
public float[] _Weight;
void Start()
{
_AudioMixer_Clone = Instantiate(_AudioMixer);
_Snapshot = new AudioMixerSnapshot[3];
//This returns the Snapshots of _AudioMixer, instead of _AudioMixer_Clone...
_Snapshot[0] = _AudioMixer_Clone.FindSnapshot("A");
_Snapshot[1] = _AudioMixer_Clone.FindSnapshot("B");
_Snapshot[2] = _AudioMixer_Clone.FindSnapshot("C");
_Weight = new float[3];
_Weight[0] = 0.2f;
_Weight[1] = 0.4f;
_Weight[2] = 0.4f;
//Which results in this method failing, because it cant find the Snapshots on the _AudioMixer_Clone...
_AudioMixer_Clone.TransitionToSnapshots(_Snapshot, _Weight, 0.1f);
}
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613193207im_/https://answers.unity.com/themes/thub/images/avi.jpg)