Hi,
I’m trying to create a generic SoundManager game object that simply fires off sounds.
Thus the gameobject has an AudioSource and a script attached.
The script has a public list of AudioClips and all I do is call the script with the array element like:
audio.PlayOneShot(_Clips[i]);
This seems to work fine.
I have 2 of these sound managers in level files for two different games. Each game has a flow of 4 levels so I have to keep the audio player around with DontDestroyOnLoad. When the game finishes I call Destroy(this.gameObject)
This is where the problem arises. If I join the other game and attempt to play, I get an error that says:
PPtr cast failed when dereferencing! Casting from AudioClip to MonoScript!
If I look in the inspector, all the clips and even the script variable are just random things in my project (some that aren’t even audioclips). I have no idea why this would occur as these are two totally separate GameObjects in two totally separate Level files. Help would be appreciated.
Thanks.