
上QQ阅读APP看书,第一时间看更新
Delaying before playing a sound
Sometimes we don't want to play a sound immediately, but after a short delay. For example, we might want to wait a second or two before playing a sound to indicate the slightly delayed onset of a poison drunk or having walked into a spell that weakens the player. For such cases, AudioSource offers the PlayDelayed(...) method. This recipe illustrates a simple approach for such cases where we do not wish to immediately start playing a sound.