private void Start() { if (mAudioEngineSource != null) { mAudioEngineSource.UpdateParameters(this); } }
private void Awake() { mSimulator = SteamAudioManager.Simulator; var settings = SteamAudioManager.GetSimulationSettings(false); mSource = new Source(SteamAudioManager.Simulator, settings); mAudioEngineSource = AudioEngineSource.Create(SteamAudioSettings.Singleton.audioEngine); if (mAudioEngineSource != null) { mAudioEngineSource.Initialize(gameObject); mAudioEngineSource.UpdateParameters(this); } mAudioSource = GetComponent <AudioSource>(); mThis = GCHandle.Alloc(this); if (SteamAudioSettings.Singleton.audioEngine == AudioEngineType.Unity && distanceAttenuation && distanceAttenuationInput == DistanceAttenuationInput.CurveDriven && reflections && useDistanceCurveForReflections) { mAttenuationData.rolloffMode = mAudioSource.rolloffMode; mAttenuationData.minDistance = mAudioSource.minDistance; mAttenuationData.maxDistance = mAudioSource.maxDistance; mAttenuationData.curve = mAudioSource.GetCustomCurve(AudioSourceCurveType.CustomRolloff); mCurveAttenuationModel.type = DistanceAttenuationModelType.Callback; mCurveAttenuationModel.callback = EvaluateDistanceCurve; mCurveAttenuationModel.userData = GCHandle.ToIntPtr(mThis); mCurveAttenuationModel.dirty = Bool.False; } }