/** * <summary>Deserialises a string of data, and restores the GameObject to its previous state.</summary> * <param name = "stringData">The data, serialised as a string</param> */ public override void LoadData(string stringData, bool restoringSaveFile = false) { SoundData data = Serializer.LoadScriptData <SoundData> (stringData); if (data == null) { return; } Sound sound = GetComponent <Sound>(); AudioSource audioSource = GetComponent <AudioSource>(); sound.relativeVolume = data.relativeVolume; if (!restoringSaveFile && sound.surviveSceneChange) { return; } if (data.isPlaying) { audioSource.clip = AssetLoader.RetrieveAsset(audioSource.clip, data.clipID); sound.PlayAtPoint(data.isLooping, data.samplePoint); } else { sound.Stop(); } }