I just finished the TEXT101 game but found it too “empty” with text only, I tought about implementing some background sounds and some scene sounds(on key down) but just don’t know how (background sprites changing with the scene would be great too).
Can anybody point me at the right direction?
You’ll need AudioSource attached to a game object
public AudioSource jukebox;
public AudioClip soundYouWantToPlay;
for sound effects I use
the PlayOneShot method takes in two arguments, the jukebox.PlayOneShot(AudioClip, volume)
for Soundtracks and background noises I just have it play on awake unless I need to stop or change the sounds.
This is a critical part about sounds.
MAKE SURE THE SOUND PLAYS ONCE!,
if you have something like
if(hasMirror == true)
The sound will play more than twenty times per second and with all those audio tracks playing at once it sounds dreadful.
That should work, though I have been having trouble doing that with even GetKeyDown, where it causes the key to trigger multiple times. I made something I call a keySwitch to prevent GetKeyDown from executing the same code on a single key press.
Oh yeah, I see, thank you so much @wcoltd. The thing is, I always have problems with these:
I guess that’s because I’m not THAT familiar with Unity and how scripting communicates with the engine.
Anyway, thanks again for the help, I’ll use this ASAP