Adding Audio and Score to your Unity Game
, and here we fix that, tie up a few loose ends, and “make it pretty”. If there is demand, there could certainly be another series with more, and more advanced, tutorials, detailing all sorts of extra functionality- but we don’t want this series to drag on forever
What you have learned in these 6 tutorials will give you the background to build much more than just what I taught- I really look forward to seeing some Webplayer builds of everyone’s “final project”, and especially to see what customizations you might have made!
What is covered in this video tutorial
- More PlayerPrefs Techniques
- Keeping Track of score between levels
- Adding audio in several unique ways
- GUI Textures and GUI Text




awesome! (first!)
Great job as always Gabe!
Thanks, great to hear!
There always seems to be more to do on this- like any game, it’s constantly evolving. Perhaps to be expanded upon, or a new series?…
2 Questions(I know u love answering those
How did u make the GUI textures.
And How did you make those sounds
Cheers,
Beast
Hi Beast-
The GUI textures you can make easily in Photoshop or GIMP, a PNG is the simplest way to go if you want transparency. Targas are better in some ways, but require that you create an alpha channel, a little more technical if you havn’t used Photoshop/GIMP much before.
The sounds I got from the VERY awesome “http://www.freesound.org/”, check it out! Great site to get free sounds for games!
I DO love answering these, haha, it’s great to see yall getting involved
gw
Thank you for the reply. I figured it was something simple. Just had to be sure.
Gabriel,
Is it possible to set the position/scale of the background and/or the GUIs by using screen.width or screen.height?
Once again,
Beast
If I understand correctly, you would like to make the background always perfectly fill the screen? The best way would be to use a skybox, I’ll add that to the list
thanks
there is one thing ive been looking for, how did you set up the camera?
Dido
Check out the newest tutorial, coming soon!
Hi !!!
Thanxx for your awesome series i really enjoyed it and learned many things from it.
I’m facing a problem with my unity software i do not get transparency when i import the (.png) Gui textures from photoshop hope you could help me. Once again thanxx for your great series.and yeah one more suggestion- may be in your next tut you could tell how to use raycast as i am trying to do fps type of game and facing the problem frame skip thanxxxx a lot and keep your good work
Hi MridulVfx- only thing I can think of is to make sure the background is transparent when you save in photoshop. Also, in Unity, set the texture compression to “DXT5″ or just set the type to “GUI”. Hope one of those tips help?
Gabriel,
Here is a request of the things to be covered in next tut.
1)Background music and getting it to play through each level seamlessly
2)Fuel system with a slider type thing or percent
3)Power Ups?
4)better fitting backgrounds
5)Publishing
#1 would be my biggest request. Thanks for the awsome tutorial. I posted LvL1
of my game above
cheers,
Beast
ooops… forgot one
also a way to view your hi-scores and save them like in old arcade games.
like…
Beast 2880
Beast 300
Gabriel 200
beast 100
…this:)
I would like to see more tutorial time on dealing with different scenes such as how to communicate from one scene to another, etc.
Thanks for the great tutorials!
Hi could we have a tutorial on creating camera tracking in the lunar lander game
Yall asked for it, and coming soon (recording right now!) is a tutorial with the following:
-fuel
-music and data between levels
-camera follows player
Hang tight, it’ll be done before ya know it!
(…and then I’ll get around to responding to your questions, promise!)
Icab you do one for a Gui inventory system. I have no idea how to do that
Is there a command in javascript that will let you turn the rigidbody on the y axis (or turning).
Right now my version of lander is in 3D (think of pilot wings with the rocket belt landing on the little floating targets).
So far I have got my player to move forward, backward, up, down, strafe left, strafe right. But I can’t figure out how to make my player just turn on its Y axis and then go in the direction that it is facing. I tried looking for the solution using unity script reference, but I can’t get my player to turn.
Here is a link so far of the lander 3d game (different theme):
http://dl.dropbox.com/u/18794921/WebPlayer.html
Thanks in advance
Gamer- you most likely want “Transform.Rotate”, that’s the simplest way to rotate an object
Take a look in the docs here: http://unity3d.com/support/documentation/ScriptReference/Transform.Rotate.html
Lots of good examples there!
“Here is a link so far of the lander 3d game (different theme):
http://dl.dropbox.com/u/18794921/WebPlayer.html”
> game controls please? can’t find out how to make the ship go up.
I got my object to rotate, but it won’t move in the direction it is facing once it is turned, it just goes straight.
I am wanting to use the “Horizontal” input for turning (which works at the moment), and then “vertical” input to move in whichever direction the player is facing.
Thanks
Ah, I see! I assume you are still using “rigidbody.AddForce”? Swap that for “rigidbody.AddRelativeForce”, and you’ll be good to go!
http://unity3d.com/support/documentation/ScriptReference/Rigidbody.AddRelativeForce.html
Thanks much, finally got it working. I am still adding more to this game of course.
http://dl.dropbox.com/u/18794921/WebPlayer.html
Is there a way that I can disable/enable the mouselook script when game is paused? Right now the game will pause like normal with the keys, but I can still look around with the mouse. I can’t seem to figure this out.
Brilliant tutorial, very well put together. I missed something though and am wondering if anyone can point me to it: setting the totalLZ variable. I know I could hardcode it at declaration, but I didn’t notice that being done during the tutorial. Assuming it’s assigned by counting the number of landing pad prefabs used or their tags, but was wondering if someone could point me to the right video. Thanks!
Ended up going with a quick array of gameObjects by tag:
totalLZ = GameObject.FindGameObjectsWithTag(“LandingPad”);
if(numActivated == totalLZ.length)
{
Win();
}
Works, but still interested in what I missed
You know, I can’t say I remember exactly anymore- but I believe that’s exactly how I had it, or very close!
However, I would find the “totalLZ” just once in the Start() function for better performance.
my LZActivate doesn’t call the win function. :/ it calls every thing else though. do i need to do more with totalLZ??
Nvm i figured it out hahahaha sorry about that
Glad you got it sorted
-Alex
I noticed on a lot of the tutorials you mentions free places to get resources for your game, so I was wondering if there was something for the sound effects you used in this tutorial?
Thanks.
You bet- http://www.freesound.org. You do have to check the license on each one though, as some are only for private use.
awesome tut! Scripting is such a pain sometimes, but that satisfaction you have when the game actually runs smoothly!