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
Lunar Lander<>

You must be logged in to upload images. Register

Discussion

36 Responses to “Lunar Lander 06: Final Audio, Score and more GUI!”
  1. Posts: 11

    awesome! (first!)

    #
    1
    Apr 11, 2012 at 8:48 am
  2. Adam Dalton
    Posts: 2

    Great job as always Gabe!

    #
    2
    Apr 11, 2012 at 10:45 am
  3. Posts: 268

    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?…

    #
    3
    Apr 11, 2012 at 12:03 pm
  4. Posts: 32

    2 Questions(I know u love answering those ;)

    How did u make the GUI textures.

    And How did you make those sounds

    Cheers,
    Beast

    #
    4
    Apr 11, 2012 at 3:33 pm
    • Posts: 268

      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 :D
      gw

      #
      4.1
      Apr 12, 2012 at 11:44 am
    • Posts: 32

      Thank you for the reply. I figured it was something simple. Just had to be sure. ;)

      #
      4.2
      Apr 12, 2012 at 2:02 pm
  5. Posts: 32

    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

    #
    5
    Apr 12, 2012 at 2:06 pm
    • Posts: 268

      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 :)

      #
      5.1
      Apr 22, 2012 at 12:30 pm
      • Posts: 32

        thanks :)

        #
        Apr 22, 2012 at 1:13 pm
  6. Posts: 11

    there is one thing ive been looking for, how did you set up the camera?

    #
    6
    Apr 12, 2012 at 2:53 pm
  7. MridulVfx
    Posts: 1

    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

    #
    7
    Apr 13, 2012 at 3:49 am
    • Posts: 268

      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?

      #
      7.1
      Apr 22, 2012 at 12:33 pm
  8. Posts: 32

    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 :)

    #
    8
    Apr 13, 2012 at 7:07 pm
    • Posts: 32

      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:)

      #
      8.1
      Apr 13, 2012 at 7:22 pm
  9. Dwayne Trawick
    Posts: 3

    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!

    #
    9
    Apr 14, 2012 at 12:28 pm
  10. Posts: 1

    Hi could we have a tutorial on creating camera tracking in the lunar lander game

    #
    10
    Apr 15, 2012 at 6:32 pm
  11. Posts: 268

    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! :D
    (…and then I’ll get around to responding to your questions, promise!)

    #
    11
    Apr 21, 2012 at 2:15 pm
  12. Posts: 13

    Icab you do one for a Gui inventory system. I have no idea how to do that

    #
    12
    Apr 23, 2012 at 2:22 pm
  13. Posts: 5

    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 :)

    #
    13
    Apr 30, 2012 at 10:33 pm
  14. Posts: 5

    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

    #
    14
    Apr 30, 2012 at 10:57 pm
  15. Posts: 5

    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.

    #
    15
    May 3, 2012 at 7:56 pm
  16. Posts: 2

    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!

    #
    16
    Oct 28, 2012 at 10:28 am
    • Posts: 2

      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 :)

      #
      16.1
      Oct 28, 2012 at 11:31 am
      • Posts: 268

        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.

        #
        Oct 28, 2012 at 12:51 pm
  17. Posts: 2

    my LZActivate doesn’t call the win function. :/ it calls every thing else though. do i need to do more with totalLZ??

    #
    17
    Nov 6, 2012 at 1:08 am
    • Posts: 2

      Nvm i figured it out hahahaha sorry about that :)

      #
      17.1
      Nov 6, 2012 at 1:11 am
      • Posts: 147

        Glad you got it sorted :)
        -Alex

        #
        Nov 6, 2012 at 1:35 pm
  18. Posts: 3

    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.

    #
    18
    Feb 13, 2013 at 2:05 pm
  19. Posts: 12

    awesome tut! Scripting is such a pain sometimes, but that satisfaction you have when the game actually runs smoothly! :D

    #
    19
    Mar 5, 2013 at 12:13 am

Leave a Comment

You must be logged in to post a comment.