HOW TO MAKE COOL TRAIL EFFECTS - UNITY TUTORIAL

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome back to Blackthorne fraud I'm Noah and today we'll take a look at how to make cool trail effects for your games using unity trails can really add an extra layer of Polish and appeal to your creations be that smoke trailing behind a spaceship some fun little effect to add to your characters greatsword or to reinforce the arc like motion of a jump there's no doubts that making tril effects is loads of fun and again can potentially make your game pop so in this tutorial I'll teach you the fundamentals of unities trail the renderer components also give you a look at how we can make a funky equi like a bank it's for this character which I find free fun to look at so this drills are such fun to make will also create a snake-like creature of course you'll be able to use these techniques to make all kinds of weird and cool-looking trails so here I have a very simple unity scene with a red to these circles right on it without further ado I'll add the trail vendor component to it to actually see our trail effects simply move the circular around the middle which will reveal this ugly flashy purple line first things first we need to add a material to this trail renderer so let's do that by clicking here the two materials I use are the sprite default material and the default particle the first of which will give you a more crisp sharp looking trail effects which is pretty cool for a more cartoony style where has the default particle material will make your trail look softer which is great for smoke for example another crucial setting for the trail vendor is timing this dictates how long the trail should be so the lordís value the smaller the trail basically typing inside means from the movements of certain parts of the trail is spawned in-game that part of the trail will destroy itself in five seconds all right let's move down to the next setting a high value to this min vertex distance will make your trail look more choppy whereas a low-value will make sure you get a nice smooth curve don't hesitate to toggle on auto-destruct which simply destroys the game object on which this drill render component is placed when the trail has completely vanished as for the width setting that's pretty self-explanatory it simply gets your trail looking thicker or more narrow which actually leads us to this really useful curve setting which we can use to lure or increase the width of the trail as certain parts for example say I wanted my curve to be really thick at the start but gradually thin out near the ends all I need to do is double-click on the red curve to add a point to it and then I can left-click on that point and pull it down no the curve shoots down and so does the width of my trail you can of course and has many points how do you like to this curve and come up with really weird cool looking trails coming up next is color here you can choose to have your trail the exact same color everywhere are like for width gradually change the color of your trail over tiny ma to change the color simply click on these lower icons you can also click on these and move them around to dictate how much or how little of your trail you want to be affected by that color you could also add more by simply clicking the bottom edge of the gradient box for example here's a fun rainbow trail if you don't want your colors smoothly blending between each other you'd always chew the fixed mode up here as for these icons they let you tweak the trails transparency I often like to Maxell the transparency at the end of my trail so it smoothly fades out sorting layers and order in layers at the same as with sprites meaning that a high order layer to this trail vendor will make the trail render in front of sprites or other trails with a lower order in layer awesome once you've had fun playing around with these various settings and have come up with a cool looking trail you can add a little script to this game object called faux cursor in it I'll make a vector2 variable in my update function called pose and set it equal to my mouse cursors current position by typing out this quirky line of code I then need to do is set my objects transfer on top position equal to pose and it will follow my mouse cursor around the scene I'll also hide my default little arrow cursor in the start function and now by pressing play I can have fun moving my object around the scene the cool trill behind it so that's one way you could make shrill effects for your games using the trail render components obviously like with almost every Unity component you can tweak the trail render settings via script so heading back into my follow cursor script for example I'll grab a reference to my trail render by making a private variable of that type called trail and setting that equal to the trail vendor components inside of the start function now for example let me change the trill star color when I hit space making a green for example and you'll see that when I hit space the start of my trail indeed turns green you can of course change its width via code transparency and so on which is pretty neat so trilha renders are really awesome adding them said anything with movements can make it look really cool for example here I have a character wielding a sword I'll parents three empty game object - it's each with a cool little drill render effect and by pressing played you'll see that my slashing sword looks that much more interesting and fun to watch so yeah don't hesitate to make multiple game objects each with a drill render compare them to your character or prop up here for example I made a character with a fun rainbow like drill effect using four empty game objects each with a drill vendor of a different color and parented to my character so that when he moves been with him all right next up let's take a look at how we can make this fun echo all I did was make a game object with the same graphic has the character called echo and added to an animation you can access the window right here and once that pops up simply hit the create new animation button I'll call my fade and then hitting the record button get my character completely transparent after about one second I'll now turn my echo game object into a prefab I'll make sure this animation doesn't loop now then create a new C sharp script called echo effect and add it to my character this script will basically spawn my echo game object every X amount of seconds so I'll make two four variables one called time between spawns the other start time between spawns and in the update function check whether a time between spawns is less or equal to zero if it is then we will want to spawn our echo game objects if not that we will simply decrease time between spawn so let me make a public game object variable called echo and I'll instantiate that right here at my character's current position and with no rotation super lastly just make sure they said time between spawns back equal to start time between spawns or else unity will spawn a huge amount of echo game objects non-stop which obviously will crash the game in the inspector in unity I can now drag and drop my echo game objects into that empty slots and hopping around the environments I'll get that cool interesting little effects of however I want my character to stop spawning echoes of himself when he is in the movement so in the script I'll grab a reference to the player scripts and only run these lines of code in charge of the echo spawning when my move input is not equal to zero in other words when my counter is moving has rats it I'll store whatever I instantiate sit inside of a game object variable called instance and I'll make sure to destroy that instance after say a seconds to be on the safe side this way our scene doesn't get clogged up with useless invisible game objects which will definitely way down your games performance of course using this exact same script you can come up with a pack of awesome and fun little effects for example you can make your echo state animation also have the game objects slowly decrease over time by giving it a scale of zero and all three axes after say one seconds or maybe you don't want the transparent version of your entire church truly behind him but some completely different sprites like a circular star this looks great on a jumping platform or character in my opinion it really reinforces that feeling of movements I also use this technique to make snake or worm like characters for example here I have this smiling head which I can move around with the arrow keys and this circular body part which I would like to use to simulate our worm like body so I'll add a new fade animation to this body and simply get it to scale down completely after about two seconds now then turn it into a prefab now I can add the echo effect script to my worms head drag and drop my body prefab and move around the scene and you'll see that I get cool worm-like motion and again have fun with how your worm like bodies behave Eva I find that scaling them up a little before scaling them down makes things look extra interesting lastly you may very well want a random object spawning behind your character in which case all you need to do is turn this echo game object variable into an array and then make an int variable call to bands right here and set it equal to a random number between 0 and the amount of elements in your array then simply spawn the game object with that random index in your echo Arabia for example here's a cartoon you Reaper character I would like him to spawn some bones and skulls in his wake so I'll drag and drop my bone game object inside of the array as well as the scour and hitting play you'll see that he indeed randomly spawns bones and skulls and that marks the end of the video I hope you enjoyed it and learn something new you can of course support my contents by a patreon like these top supporters I can't stress enough the awesomeness of donating even just a dollar it's really appreciated and helps me continue making regular game dev contents hitting the like and subscribe buttons would also be wonderful with that said stay tunes have a great day [Music] [Applause] [Music] [Applause] [Music]
Info
Channel: Blackthornprod
Views: 223,574
Rating: undefined out of 5
Keywords: blackthornprod, noa calice, game dev, trails, particle, effects, fx, art, how to, trail renderer, component, C#, c#, programming, snake, smoke, echo, movement, cursor trail, particle system, game effects, indie game dev, unity, tutorial, HOW TO MAKE COOL TRAIL EFFECTS - UNITY TUTORIAL, beginner, easy, snake movement, sword slash, bullet trails, weapon trail, fireball
Id: _TcEfIXpmRI
Channel Id: undefined
Length: 10min 38sec (638 seconds)
Published: Tue Jun 12 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.