Viewers: in countries Watching now:
Interested in game making? Start in Unity—a game engine for mobile and desktop games and real-time simulations. Author Adam Crespi shows techniques used in game development with Unity and introduces the basics of scripting and game functionality. First, learn how to import models and textures, organize your project and hierarchies, and add terrain, water, and foliage. Next, Adam explores how to use lighting to bring the game to life, and add rendering, particles, and interactivity. The end result is a sample game with a lush environment, fully animated characters, and some basic interactive gameplay.
We can animate just about anything we'd like here in Unity. We're not limited to animating simply objects and simply rotations and positions and so on. We can animate lights and materials if we'd like, really bringing our scene to life by turning on lights in our gallery for example. I want to note that warning down in the bottom of my screen as well. It's in yellow, and it's says the animation clip, French Door 20 Swing used by the animation component, French Door 20 must be marked as legacy. What that simply says is that that they've added in a new feature in recent versions of Unity called, Mecanim.
And although the animation component is perfectly fine to use and very good for simple things like this, for more complex animations and transitions between states, Mecanim with animator components is available. It's a warning in yellow. It's not a show stopper in red. If it was in red, saying for example this syntax and the code doesn't work, we have to fix it before we compile. But a warning like that just says wait a sec, note this, and if you need to do something about it, that's fine. I'll add a spotlight into that cam light choosing game object, create other, and spotlight.
I'll move my spotlight up, and go into a bottom view to align it with the cam. I'll click on the bottom arrow here on my view cube and switch over from a perspective to an orthographic view. I'll pull this light over, aligning as well as I can. I'll switch back to a perspective and orbit back around. That's pretty good. As long as it's fairly close, it'll be fine. I'll pull that light up just underneath that fixture and that's an important one in lighting. When we're lighting, we need to make sure that our lights are not submerged in geometry, otherwise, we'll have some very odd results.
We'll get weird shadows and things. So this is a preemptive move to handle problems before they happen. We'll make sure the light is just below. We really can't tell once we see the circle on the floor, exactly where it's coming from beyond generally that place. Now I'm going to make an animation for that light to turn on. I'll choose Window > Animation. And here I can create a new curve first, or just start animating and name the curve as it's created. I'll go over to, well let's say 130 and as soon as I do, Unity says would you like to create a new animation? And I will and I'll call it SpotLightOn and I'll put this in my assets animations folder.
Now, I'm ready to animate. For this light, I'll change that intensity. I'll crank up the intensity to oh, about 1.2 or so and then come back here to frame 0, and pull that intensity almost all the way down. I'll put it in here at .1, so the light's just a little bit on. Now I can go into the curves and adjust those tangents if needed. I'll pull my animation window up, click on curves and take a look. And although it's a very slight adjustment, those are actually flat tangents. I'll pick both of those keys, right click and choose flat.
Now instead of a linear light turning on, it does a slow in and slow out, smoothly easing on in the scene. I'll pull this down and play that animation to see if it worked. There's the light turning on, and I'll adjust the spot angle of that light to be a little bit bigger and my animation will be in good shape. I'll turn off the animation window, so I don't animate that spot angle increasing. I'll pull this up to oh about 55 or so, and it's just enough to catch that art. My light is animated and I can trigger this animation and animations on other lights if needed through box colliders just like with the French door.
This way my player can just in time to knock over the yard have the light come on. As a side note, if you'd like to explore more we can animate materials as well. I'll look at the material on this object in the animation window bearing in mind, I need to have probably a separate material if there's other cam lights that are always going to be on. But I'll at least check out what can I animate on the material itself. I'll pick that cam light surface mount object, and we can see it's got 2 materials, lit bulb and brushed bronze. I'll go into my animation window and make another new curve.
I've named this new anim file, canlightmaton, can light material on, and I'll save it in the animations folder. And now I can add in a curve clicking add curve and under mesh renderer, there's my various material properties. Things like color, emission, illumination, reflection color, and so on. I'll pick material color and hit the plus next to it. Now in this material color opening it up, I can animate the main color of this material to multiply over that self illuminating light.
I'm going to leave this alone for now. If you'd like to play with this you can. We need to create a new material for cam lights that stay on. So bear that in mind when you're animating that because it's a material animation, anything having this material will get that animation. I'm going to take off this animation here and just let that spotlight turn on where the lights generally look lit. Well we can only tell if we're underneath them.
There are currently no FAQs about Unity 4.3 Essential Training.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.