2.5D Sprites w/ Animations URP - Unity 2022 LTS (Tutorial)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello in this video I'm going to show you how to create a two and a half D character in unity this is the way that works for me so hopefully it'll work for you first thing I'm going to do is any Unity Hub I'm going to go to new project I will just choose a standard 3D project and I will name mine to wait five D tutorial and I'm just gonna change where I'm saving this so I'll just put it in tutorial projects folder that will be fine and I am going to change to the 20 22.3.2 F1 long term support version of the editor I haven't used this version yet so hopefully this method will still work but once you do that I'm just gonna hit create project and it'll create the project and open it for me all right now that I have my project I am just going to add a few things through the package manager so I'll go to my package manager tab go to the unity registry and I'm going to be using uh the universal render pipeline as well as these uh 2D Sprite packages I will first import this beauty Sprite package I am also going to install the 2D animation package and then I will go ahead and add the Universal render pipeline package so let's Universal RP I will install that as well all right I'm going to go back to the scene view here I don't know why it's all dark maybe that's just my lighting settings but whatever um all right well I'm gonna go over to my project folder I will create a new folder I call it rendering and inside this folder I'm going to right click go to create rendering and I'm going to want a urp asset with universal renderer that'll create these two uh pipeline assets here and in here you can control all the settings for how you want things rendered so now that we have that we're going to go over to project settings graphics and I'm gonna drag and drop one of these two into this render pipeline asset field and hit continue and now we should be rendering in the Universal render pipeline and in my sample scene I am just going to go ahead and make a plane just so we have a ground that we can look at [Music] and I will create what will be our player object and I am just going to zero this out same thing for the plane then underneath the player I will add a 2d Sprite where and I'm just going to name that game objects at child object Sprite and you can see here we got just a plain old white square and to make it a little more interesting I am going to use one of my pre-made assets that I made for a game I'm working on that also uses two and a half d so I just drag drag my uh play art here I'm going to change my uh player Art texture to a Sprite 2D with multiple Sprites I believe it is 32 pixels per unit a set compression to none and filter mode to point no filter these bottom two options I set those for pixel art specifically as if you don't then the colors will blend and not look right I'll hit apply now I'll go into the Sprite editor go to slice and I can go by size it should be 32 by 32 I want the pivot to be at the bottom so the uh players movement and scaling and everything will be based on the bottom of the image if I slice that you can see the pivot is at the base of the player I will hit apply and I will save that so now on our player Sprite I can change this to be one of those Sprites that I brought in so I'll just choose this and you can see [Music] zero that out now you can see the uh the player is standing on the platform and it is uh technically two and a half D players flat in a 3D World uh but it doesn't really look all that great and one thing I do uh make it look a little more convincing is in on the Sprite object with the Sprite renderer I will go up here to debug and you can see an option here for casting Shadows for the Sprite renderer that is turned off by default and if you go into debug mode you can turn that on but then the uh the object should be uh casting Shadows if the material allows it material I have on it right now does not so it is not casting a shadow so I will go back to the normal mode and in our project folder I will right click go to create folder [Music] and I'm just going to call this uh shaders and we're going to create a material that'll allow our player to cast a shadow so I will right click go to create Shader graph urp because we're using the universal render pipeline and I will choose a lit Shader graph and I'll just call this Sprite leader if I double click that it will open up a Shader graph so I will add a texture 2D here and I want to call this main text and the reference here is going to be underscore main text I'll just drag that out hook it up to a sample texture node and a graph settings I also want this to be transparent that way the alpha can come through I will feed our our GBA node into the base color and Alpha into the alpha I will save that [Music] and going back here I'll right click on our Shader object in our project folder go to create and material and let's go back to our scene View and I'm just going to drag it onto our player you can see now it is casting a shadow however the Shadow's not really great and there's like a weird cookie cutter looking thing around the player so I'm going to go back in here and see if I can figure that out I do recommend turning on both for the render face it's a little more costly to do so but if you have it on both then when you go in here and you look at the back of your Shader or at the back of your Sprite it's not going to disappear on you so you can see it from all angles okay so I just figured it out at least I believe I did so instead of transparent I'm going to change it back to opaque and then I'm going to choose Alpha clipping here and then you can just feed your Alpha into the alpha slot again and the clip threshold is right here so anything that would register is below 0.5 per pixel and your texture is going to be clipped out so I will just save this go back to our scene View and now you have a more accurate-ish Shadow we can play with the render settings make that a little better but you also don't have the uh the weird cookie cutter shape around your player so let's get the shadow looking better I'm going to go into our rendering settings for our Universal render pipeline and I am going to just max out this Cascade count [Music] and you can see the shadow is now in the shape of our player that looks pretty good I will save our scene so one advantage of doing it this way is you still use the Sprite renderer which is good for animations so if I went to our player and I added an animator and I go to the animation tab you can create an animation here make a new folder for animations I'll just call it layer walk for the animation [Music] and I will hit record here go to our Sprite object and I can always just change the Sprite like you normally would for any 2D game and it should just work I'll make a little walking animation here [Music] and if I play this yep the sprite's just walking the Shadow's updating and it is in three dimensions with the uh the flat character so what people would call two and a half d that is about as in depth as I want to go for this video um if you want to see more or learn more things about this two and a half D implementation or tricks you can do or if you just have any questions leave a comment down below thank you very much for watching goodbye
Info
Channel: MichaelsGameLab
Views: 11,685
Rating: undefined out of 5
Keywords: unity, tutorial, how to, game dev, game development, unity 3d, 3d, urp, universal render pipeline, unity 2023, shader, graph, shadergraph, material, 2022 LTS, 2.5D, 2.5d, unity 2.5d, 2.5d animations, animations, debug, sprite renderer, sprite shadows, sprite, shadows, realtime lighting, realtime, light, sprite animation, animation, octopath, traveler, octopath traveler, michaelsgamelab
Id: GiUgQMkMI2o
Channel Id: undefined
Length: 13min 11sec (791 seconds)
Published: Tue Jun 20 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.