unity 3d student

Intermediate I02 – Basic Animation and Events


How to use the Animation window in Unity and trigger script events.

Code Used (Javascript)

  1. var blip : AudioClip;
  2.  
  3. function blipSounder () {
  4.  AudioSource.PlayClipAtPoint(blip, transform.position);
  5. }

Further Reading

Share via Social Media

  • Digg
  • StumbleUpon
  • del.icio.us
  • Facebook
  • Yahoo! Buzz
  • Twitter
  • Google Bookmarks
  • Add to favorites

45 Comments

    Just the kind of tutorials I was searching for.
    Did all the other modules.
    Now my understanding of game development (with Unity) is not so fragmented anymore.
    I only have a small request, maybe it is possible to add also the C# code?

    • Am currently considering doing a C# / JS differences video and / or the translations, the problem is finding time at the moment, will do my best! πŸ™‚

    Heeeey !!!
    great things your doing here,
    it is really helpfull for me as a learning
    unity user.
    but ofcourse i still have questions πŸ™‚
    i wanted to use a trigger ( player walks through )
    that triggers an animation. ( real simple stuff as in walk in
    { or use a visual trigbutton } that opens a door.
    but when i write the script it says it needs UnityEngine.Animation
    in the script. can you maybe send me a simple script where i can look at
    to further understand how it is made. no need for a here-is-the-full-script kinda thing. but just to send me in the right direction. ^^
    and i am not done here πŸ˜›
    i am now looking for a while on some info on pick-up scripting.
    and with pick-up i mean having a var that keeps count of how many ( points or- gold – ) you have. & using a script that i attach to a gameobject in the world
    when i collide with it it adds the amount of points the object stands for.
    in the same way i can use the same script but then the other way around for when as example i buy something in the game world then the points go down the ? amount.
    i have been searching for these kinds of scripting on YT in tuts & in the unity script API but never really get clear info on how this works.
    its always something thats speciffically for 1 purpose.
    & id rather know how it works so i can do it all myself.
    thanks for all your help in advance ,
    your vids help me greatly & tend to challenge the reader/watcher
    to use the info provided & play with it for better understanding.
    so i hope you can help me,
    & im looking forward to seeing your next vids.
    Greetz
    your proud student ^^
    Dion

  • Hello!

    Thank you for that great tutorial.

    Can you make a tutorial about imported animations and how to manage them in unity, please?

    I’m working in modo 3d from luxology and don’t get so clear how to work my assets’ animation πŸ™‚

  • Thanks Will !

  • Hey, Thanks for these great tutorials! Looking forward to seeing more!

    How did you switch to that dark theme for Unity? Can this be done in the Windows Version also?

    • Hi Mikkael, its the pro theme of Unity 3, available very very soon!

      • Oh, thanks! Another reason to go Pro, i think i’ll finally buy it…

    Wow, your tutorials are so awesome! I’m really looking forward to see more tutorials. These are the best tutorials I’ve ever seen πŸ™‚

  • Hey man, this is awesome!
    You’re really doing a great job! You got a fan from Brazil!
    Gave you some feedback (with new idea)!
    Waiting for more… πŸ™‚

  • I’ve only just started playing around with the animation tool in Unity 3.0 (I’ve been using Unity iPhone 1.x up to this point), lots of useful information here. Thanks!

    • Cool! Glad it’s helpful Tim, cheers. Might be worth you checking out iTween and its associated visual editor too, have you heard of them?

    Hi,

    I’m confused about using the animation window or using iTween. Is iTween better than the animation window? Does the animation window makes everything that the iTween makes? Thanks!

    • iTween is a library of ready made anims and does an excellent job – go contribute to Bob Berkebile’s work at PixelPlacement.com if you can. Basically its a big time saver. You can make your own anims, or use iTween – its an equivalent of using jquery instead of writing javascript for the web for example. Many people prefer it as it means you don’t waste development time, and for that reason its worth getting for sure. This said its always worth knowing the tools behind libraries such as this, so it is worth using the Animation window to get used to it.

    Very very good tutorials, I’ve completed all you’re modules, please please make more, Its helping to get the basic down perfectly! thanks – Caius

  • Hey loving the tutorials so far here. Is there any chance you’d be able to do one on or give some advice on getting an object to rotate to face the mouse cursor?

    I’m trying to start making a top down shooter in space at the moment and I have absolutely no idea how to do that. Any semi working example either had the ship spinning out of control or it just wouldn’t rotate. This is getting pretty frustrating.

  • Hi again Will, pardons for all the questions!

    I am creating a shooting gallery game using what I’ve learned from the modules (and then some)! The player controls a gun object, which for the time being is a cube parent with a smaller nozzle cube child (both rigidbodies). I created a simple animation on the cube parent to resemble a gun kickback when the player shoots, a slight rotation on the x axis back before returning to the default position. The player controls the gun with the arrow keys, which AddForce() to move and transform.eulerAngles to give the gun a bit of a tilt.

    Everything is working soundly with the animation with one exception: the kickback animation always resets any tilt that has been added to the gun object, which isn’t the end of the world, but a little choppy looking. Is there anyway to control the animation so that it rotates relative to the gun’s rotation at the time it initiates?

    Thank you *so* much for all of your help!

  • Holy shit these tutorials are amazing.

  • Greetings ..
    great, great
    as a teacher are wonderful
    please put more tutorials for intermediate and advanced in the future to

    thank you very much,,,,

  • very good tutorial. can you make bantumi game using unity.

    • I’ve no idea what that is but you can make any kind of game in Unity.

    Please continue posting videos!

  • hey nice tutorials but im still confused. mabe its cus im 13 but i just love games and i wanna start learning early for my career

    • Hi Rachel, no problem – what parts are you confused by most? feel free to ask questions here or email me using ‘will [at] unity3d dot com’ if you need help, well done for starting to learn early!

    Fantastic tutorial. I watched them all in one sitting. I wrote pages of notes. Tomorrow it’s time to fire up and write a little game. I have been programming games for years at a bery low level (C/C++). I am astounded at the power of a tool like Unity. At first glance the tool intimidated the heck out of me. But, thanks to your videos, I am going to make games not just piles of code to do the simplest thing. Thank you.

  • can you post a tut on how to make sounds? Or do I need a new program?

  • I followed your tutorial, but for some strange reason, the blipsounder function isn’t showing up in the event dropdown. I’ve dragged and dropped the audio file onto the function, yet it doesn’t show… is there something I need to look for? I’ve repeated your tutorial a number of times, and am even naming everything the same (except for the audio file). I can hear the mp3 audio file in the player.. but yet, I can’t seem to get it to show up as a function.

  • Thanks so much! Curious to know if animations in Unity are frame rate independent.

  • Hey there Will,

    Just finished your entire set of tutorials in 2 days time.. haha, honestly, i absolutely love them. I just found out about unity 3 days ago from a friend and wanted to get into it.

    Are you going to be making further tutorials and challenges? i really hope so. I need more references and ways to do things just to give me more ideas for an actual game i wanna make.

    Once again, i love the work you do and thank you for the time you put into this, not everybody can help others but you, sir, got it!

  • Great tutorial.
    Continue working with this amazing tools.

  • nice tutorials. just started to work with Unity and now confidant of going advance. thanks.

  • Thanks for the tutorials. I have now watched them all and completed the three challenges. They have been very well made. I started at the first tutorial with hardly any knowledge of unity and now I feel I have learnt enough to really start making some interesting stuff.

  • You Rock my friend.

  • Already bought and readed your book here in Poland! πŸ™‚ Awesome… really awesome πŸ™‚ you’re doing great work on this website ! πŸ™‚ Book is also good, I’ve learned a lot thanks to this book. You’re the best! πŸ™‚

  • Awesome Tutorials!! Are you planning any more intermediate tutorials?

    I have done all the modules and have learned incredibly more than the Uity3D tutorials. Thank you for your straight forward style of teaching!!

  • So in a fighting game, when you have a character throw a kick, you can specify on which frame damage should be applied to an opponent.

  • […] SCRIPTING IN UNITY I got the door to open and close smoothly when you click on it! This tutorial shows how to make a Unity animation: http://www.unity3dstudent.com/2010/09/intermediate-i02-basic-animation-and-events/ […]

  • Hey! Nice tutorial, but where do you get the Sounds file? I can’t find it and I’ve looked at the Import Packages (which doesn’t even mention “sound”).
    Please help.

  • Also, how do you make it so when you Press space, it does the action once until you hit space again?

  • DUUDE when will you post more videos!!! I love your Tutorials!!

  • GOD BLESS CLEAR TUTORIALS!!!

    Woooooooo!

  • Why is the “transform.position” needed? Why not just play the sound at the event?

  • […] Intermediate i02 – basic animation and events Learn video game development with unity game engine the easy way!. […]

Leave a Comment