A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.unity3d.com/Manual/sprite/../../ScriptReference/AudioClip.LoadAudioData.html below:

Unity - Scripting API: AudioClip.LoadAudioData

AudioClip.LoadAudioData Suggest a change Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close Your name Your email Suggestion*

Cancel

Switch to Manual

Declarationpublic bool LoadAudioData();

Returns

bool Returns true if the clip is loaded into memory.

Description

Loads the asset data of an AudioClip into memory, so it will immediately be ready to play.

Use this method when your application can afford an upfront performance overhead, which happens because this method loads resources in ahead-of-time. For example, use AudioClip.LoadAudioData in the Start() method of MonoBehaviour."

If you use AudioSource.Play to play an unloaded AudioClip, AudioSource.Play will load that AudioClip. If an AudioClip is already loaded, AudioSource.LoadAudioData will not reload it and return true. This method won't reload AudioClips with preloadAudioData set to true.

This method loads the AudioClip synchronously, unless AudioClip.loadInBackground is set to true.

using UnityEngine;

public class LoadClipAtStart : MonoBehaviour { AudioClip m_Clip; void Start() { m_Clip.LoadAudioData(); //Components that use AudioClip, for example AudioSource, are ready to immediately use the audio data, rather // than triggering a load themselves.

} }


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4