Create 2D lighting in Unity 2022 in 5 MINS!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
now adding lighting into your game helps a lot in how the game looks and feels don't believe me this is a scene with no lighting and shadows and this is that same scene but with lighting added now that should have been just enough to show you the importance of lighting in your games now before we start the video i'd like to say that this video is actually one lesson from one of my udemy courses on how to create a moody atmospheric 2d game using unity i have 7 000 students on udemy and the 4.5 star rating so if you get any value out of this video be sure to check out the course in the bio which is currently 60 off for a limited time only and with all that out of the way let's get started with the video alright so in the last lesson we just added tiles to our game in this lesson we'll be adding lights using the urp package so to add the urp packages gonna go to window go to package manager and i'm just gonna select unity registry and right here i'm just gonna type in i'm just gonna type in universal render pipeline here it is now install it so the universal render pipeline is basically a a pre-build render pipeline made by unity you can create optimized graphics for a range of platforms using it we're just going to be using the 2d lighting functionality from it and wait a bit for it to install it's not going to take too much all right so after the package is downloaded just close the window i'm going to right click in the assets go to create go to rendering right here in the bottom now this won't show unless you have the universal render pipeline package installed so go to urp asset with 2d render urp lights now it'll create a new urp urp lights asset go to edits go to project settings go to graphic and setting the urp lights to the render pipeline asset click on continue and now you have it done go to go to the players material and go to the material section in the sprite renderer component deselect this eye icon and select sprite lit renderer spritelet default and now go to the tile map go to the tile map renderer and go to the materials section deselect the eye icon again and go to spritelet default now i'm going to right click in the hierarchy go to light and select spotlight 2d now everything just turned to black and that's actually a good sign so now if we go and put this light near the player the player lights up i actually have a lot of different settings for this light right here actually put it here we can make the strength of it you can change the strength of it we can change the falloff strength of it so basically just play around with the settings and see what you prefer awesome so what i'm going to do is i'm going to select the player and right click on the player go to light and select a spotlight 2d now it'll create a light as a child of our player what i'm going to do is set the intensity to 0.4 set the outer radius to something like 2.11 and set the inner radius something like zero maybe maybe eight increase the intensity a bit i'm going to create a new 2d object sprites i'm going to select this square sprite now i'm going to make it a bit bigger i'm going to set it as the background so i'm going to make the outer layer for its minus one i'm gonna set it like this like so maybe even minus five i'm going to change the color of it to this blue color feel free to copy this color if you want or just select any color you want now i think the light is a bit too much so what i'm going to do is i'm going to select the outer the inner light to be 0 and the outer light to be 2.11 i'm going to create a new global light another global light so a global light 2d a global light just basically lights up the entire scene that's why it's called global light and i'm going to set the color of this global light to this color and set the intensities to zero points to 0.12 maybe changes if you want to something a bit darker but i'm going to keep it something like this i'm going to go back to the player and set the falloff strength to something like 0.668 and awesome these settings look pretty good i'm going to create another light 2d and create a 2d light i'm gonna i'm going to go to light again and i'm going to select and i'm going to select freeform light and select square awesome so this freeform light is actually a pretty handy tool it's like the spotlight or you can actually edit the shape of it so i'm just going to edit the shape to match the eyes shape so something like this i'm going to change the the color of it to something like yellow i'm going to set the color of it to something like this the intensity to something like see 1.19 and the falloff strength to something like 1.71 and the falloff strength set it all the way to 1. now i'm going to duplicate this right eye and set it for the left eye alright so now it looks pretty alright so now it looks pretty good i also would like to say that if you want to change the settings a bit and make it look a bit better and make it suit your preferences have at it you don't have to follow these settings bit by bit if you want to change these settings feel free to
Info
Channel: The Game Dev Show
Views: 48,831
Rating: undefined out of 5
Keywords: unity, game development, indie game, making a game in 48 hours, dani, brackeys, brackeys unity tutorial, blackthornprod, jonas tyroller will you snail, making a game in unity, the game dev show, indie game development, game making in unity, game dev, how to create games, unity tutorial 2d, unity beginner tutorial, unity lighting, unity lighting 2022, unity lighting tutorial, unity free course, unity tutorial beginners, how to make games with unity, 5 min lighting in unity
Id: ACyqpLh4jrs
Channel Id: undefined
Length: 5min 29sec (329 seconds)
Published: Tue Jun 28 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.