Monster shadow


DOTWEEN is the BEST Unity asset in the WORLD and I'll fight anybody who disagrees

DOTween is the very first thing I install upon creating a new project. Animate your position, rotation and scale in a single line of code, with all the customization you could hope for... and that's only scratching the surface. For the full documentation: ========= 🔔 SUBSCRIBE: 🗨️ DISCORD: ✅ MORE TUTORIALS: 00:00 Stupid Intro 00:20 What is DOTween / Installing 02:00 DOTween basics 08:35 Sequences and Tasks 14:37 Additional features 17:55 DOVirtual - Tweening values 18:55 SpeedBased for reliable speed over distance

For everybody commenting that I pronounce it wrong: If you were about to blast me for it and then saw this, you have to like this comment to apologize to me 💋
Nice costume
@Tarodev Hmm that's what a DELETER would say... Anyway nice tutorial and who cares how you pronounce things.
@Daniel Tranca I've actually never deleted a comment in my life. But I do notice sometimes I click a notification and it goes nowhere... I think YT scans them and deems them hostile or something? Not sure
Daniel Tranca
I disagree with you. There are better libraries, and I would post it here, but you keep deleting my comments....
Odin inspector, Ampllify shader editor, Rayfire. Not looking for a fight, but...
Bhaumik Shukla
DoTween does generate around 25-50 KB of target per tween too quite often
Neotrix Sine
How is it working when it is on void start?
Crispy Critter
and all this time i thought it was called Do tween not dot twean as you say it lol, this is a great asset i have been using it for years
You were not alone in that assessment lol. I've been barraged by people for saying it like that
Ole Midthun
Great video. DOTween is my most critical tool on any game jam haha. My addition to this video would be: Kill VS Complete. You can Kill() a tween/sequence which has its corresponding onKill event. And the same goes for Complete() and onComplete. If you rely on something in an onComplete callback, this will not be called if the tween is killed. Just worth mentioning, since it also means you can add different behaviours by utilising both. Now I'm off to watch the async video :)
Check out the first optional parameter for Kill 😉
Thoughts on dotween vs leantween? (If you've used both) 🙏
Clicked on the video to write this comment: YES
When i use DOTween in my project i feel like a coward because it makes everything easier. Actually u may take a video like how to do it with Dotween VS How to do it with Lerping,Mathf etc.
Stephen MacKenzie
Awesome. It sits in a long line of game dev tools no one can pronounce, like Godot 👍🏻
cromis gameplays
JTween Is better
This is EXACTLY what I was looking for. Great video, thanks!
Thiago Torres
Subscribed! Amazing content mate!
5:25 Woah, I never knew it was more optimized/faster to use the * operation over /. I usually just use whatever is easiest to read and more simple, which I probably would recommend to anyone that has a simple application. But I will remember that for future, thank you!
Lynx Lynxov
I think the compiler will replace invariant division with multiplication for you.
Tomas Szilagyi
Super video thx! :) I use DOTween a lot but i learn some new stuff today :)
Pixel Pete (Peter Milko)
I love it, I use it in UI! By the way I am making a tower defense dungeon crawler "Dwerve" and teach pixel art.
Marc Dirian
hi ! I love your tutorial although I'm French and some words keep some secrets for me. Well, I'd like first ask you if you made a tutorial to learn how to make so smart cube as your yellow cubeas other ones. I imagine it is so basic that you will laugh but if I use quite good C# and basic 2D unity, I need your style of animations (even Dotween) to create an animation based on brain comportemental actions. It could appear as an unusual step to approach unity games but I work on it for 3 years now with many diagrams and now need to experiment my theorys on a 3Dworld. My cube will be my avatar and the 3D environment his external word in witch he will lear life trough his brain evolution. I need to start to the beginning and your tutorials are so rich that you will be my Master for unity and I watch all of your videos. Thank's a lot for reading. Malcom from Paris
Thanks Malcolm! Glad you enjoy my content and good luck with your cube ❤️
Has anyone used both Leantween and Dotween? Which one is better and why?
Why?! WHY?! Why you didn't do this video earlier?! I had no idea about all this nice features of Dotween. Thank you very much!


hello happy halloween welcome to the video uh
today i'll be showing you uh why dot twain is
the best uh extension for unity
so uh let's get straight stuck into it eh
okay welcome so i've got a bit of a nerd boner today
because i'm showcasing dot twin what it does is it
assists you in uh animating your objects so if you want to go from point a to
point b what happens in between those two things uh can be handled by dot
twins so you might just want to send it across from a to b in on a linear path
you might want to curve it uh you might want to scale it doctwin can help with
that and it is absolutely my favorite add-on in unity so
let's get stuck in to download it just head over to the dot tween asset store
and just add it to my assets if you've already got it obviously you
can just open it up in unity once you've actually installed it once from here you
can just go straight to your package manager
and just search like dot twin and i've actually bought the pro version
but i'm not going to be using that today just the normal regular version uh
import it i've already imported it but i'll do it again
all right so once it's installed just go to the dot queen utility panel click
setup dot twin and in here you'll be able to add or
remove your modules to make it leaner on compile time
i personally always disable the physics because i i i never use the uh the
tweening physics i always just use the transform physics
but that's up to you so click apply oh and also down the
bottom here if you've got uh the pro version you can uh add additional
tweening to things like text mesh pro for example
okay so what i've got here is a nice little scene and what we're gonna do is
just learn the basics of dot twin so first let's move these shapes across
here so they're sitting at zero on the x let's move them across to ten on the x
okay and the shape itself is just this parent object and it's got these two
shapes in it the outer and the middle one and then the actual main shape has
the shape script on it so let's open up the shape script
as you can see we've got the two references to those inner shapes
and let's move the parent object so transform dot do
move now every method of dot twin starts with the do directive okay so that makes
it nice and easy we'll say do move and it's
saying what is your end value our start value is where we're currently sitting
at when we start this tween so let's give it the end value which will be 10
on the x zero on the y zero on the z the duration will be let's say two
actually let's not say two let's serialize a build here
uh called cycle length
and let's set this to two seconds and let's use that there instead
and that is actually all you need to make this tween
right so let's go across and try that out
[Music] beautiful and as you can see dot twin is
actually adding a little bit of easing to it uh it's starting fast and it's
ending nice and smooth though and we can actually override that ease by saying
set ease here and
we can do ease type and as you can see there are heaps of eases here that we
can choose and the ones that say just in at the start means the ease is being
applied at the start out at the end and then in out both start and end
so let's just uh let's try in bounce for example
and you can see how much of a drastic change uh a bounce will have
like the hat bounces pretty cool uh but obviously that's not gonna suit
us very well so let's do uh in out sign i think that's always a nice one and
then it would be nice if we were sending it across and then back again and kind
of repeating wouldn't it so we can actually chain another method here and
by the way this is called method chaining
so let's chain another thing let's say set
loops it's asking how many loops we'd like
let's say infinite amount of loops so minus one
and then we're asking for the loop type which we should use yoyo here right
because uh yoyo will go from one side to the next and then it will now use the
start position as the goal and it will reset it and then go back and forth back
and forth so let's try that out
press play cross and back again
and it's that easy to set up these uh tweening with dot twin
so next let's actually have this middle shape here uh spinning around
so let's grab the reference to our inner shape and instead of saying do move
let's do do rotate
and let's say we'll do a full revolution so new vector 3
0 360 and zero
and then instead of the full cycle time let's actually do cycle time
divided by two so let's make it go pretty fast
a little hot tip by the way uh instead of if you can always multiply instead of
divide it's a much faster operation obviously the computer can do like
countless of these every frame but you know always be as optimized as possible
and we want this to continuously loop so let's do set loops
minus one and instead of using yoyo here we want it to just keep going around the
same way don't we so let's do loop type restart
uh and then also let's kind of just have it going at a nice even pace all the
time so let's set a's and let's use linear
there we go so let's try out this
aha nothing happened and that is because we are saying
we want to rotate to this new uh degree so in the back end this is
actually turning this into a uh i say quaternion every differently
every time so bear with me but it's turning it into a quaternion which is
actually exactly the same as our start position oh god this thing
exactly the same as our start position isn't it so uh it's not actually needing
to do anything we're already at our goal position
so uh we can fix that by saying instead of
rotating to the this rotation i want you to rotate by this amount of rotation
so we can change the rotate mode here to fast beyond 360.
so that will say whatever you're at now rotate another 360 degrees and obviously
we're looping so it's just going to continuously go and go and go
very cool very easy uh let's do something a little bit cooler now let's
um take the outer shape and let's rotate
that like that and then let's have this middle shape
kind of like going up and down like this so let's start it at like three on the
on the y and then let's grab our inner shape here
inner shape do move
and let's send this to a new vector three zero on the x minus three on the y
zero on the z and then the cycle length let's also do
it half the cycle length so divided by two
um and then we could probably just use these loops here same loop same repeat
let's try that let's see what that does aha so it's moving to world coordinates
and that's not really what we want is it we want to do local movement according
to our parents uh position so we can just do do local move as easy as that
let's try that out [Music]
excellent super super duper easy all right so that's the basics of dodd
tween okay so you set up a tween and then you can just like chain these
additional things on there there are heaps uh but these are just like you
know two of them set a's set loops uh but you'll you'll learn more as we go on
so let's continue dot tween
number two so i've got these uh weird looking blobs
here what i would like to do to them is send
them across one by one and then once they're all across let's scale them down
into zero okay and get rid of them so let's open my weird shape manager
and i've got my reference to those three shapes here
so let's uh let's i'll show you it this way first so
shapes the first shape in the array
uh let's uh do move and because we're only moving on the x we don't care about
the other ones let's just say do move x and the end value will be 10. duration
will be let's make this a little bit exciting by doing a random value
between 1 f and 2f and okay so now we want to do
shape 1 index right but we don't want to do that until this one is finished so
how do we do that well we can chain onto this and say on
complete right so what what do you want to do when this tween is complete
what function would you like to run so we're just going to give it an anonymous
function here and now we can take this exact thing
here but instead say shape one and then on
here we want to do the next one right so we can do on
on complete onto the next one and as you can see this is getting a
little bit messy right a little bit convoluted but this this works perfectly
like this does the job let's try it out so this one will go
and then that one will go and then bob's your uncle that one will go
beautiful uh
and then now we want to scale them don't we so
what what can we do well we can now do another one another on chain here
and then here we would just like them to all go at the same time so we can just
say four eight shapes and we'll say shape
do scale and we want to say down to zero because
we want them to disappear maybe 0.5 and it might be cool if they kind of
like bounce down right so let's set an a's here and then in bounce
and let's try that out one
two three and bounce away
so that works right but this is a disaster
right it's it's pretty disgusting it's very hard to read at a glance and
actually it's kind of reminding me of uh old school javascript before we had
async and we're kind of like chaining all of our api requests one
after another which uh probably triggered a few people but
so this is the exact reason why
sequences are around so let's create a sequence dot twin
dot sequence excellent and now with this sequence we
can kind of like orchestrate uh all of our tweens
guys um
so let's iterate over our shapes
and we can say sequence dot append right so
uh this will always add it to the end of the list
and we can actually send in a tween here just like that and obviously we don't
want to use shape 0 every time we want to use the iterated shape
and the thing about sequences is you don't actually have to manually start
this as soon as it goes out of scopia just like an eye disposable it will
actually action it and it will run the uh sequence for you
so that's handy dandy so as you can see this will now go one
two three
so much cleaner than chaining them as you can see
uh and now just as we called on complete on the tween itself we can now call on
complete on the sequence so sequence on complete
right and then we can actually grab these and do that in the exact same way
just like that and that will have the same behavior
one two
three and bounce out
excellent so sequences are great right it solves a
problem but if you were watching my async
workflow video from the other day uh you're probably wondering is there a
better way can we use async for this and yes indeed we can and you probably
guessed that by this little giveaway here but let's comment
out these oh not delete them and open this puppy up and let's
uncomment that so let's run this async baby function
so as you can see here we're iterating our shapes and we are now able to await
the tween and we can do that by appending this chain method here async
wait for completion we can now await it so as as you can guess it's going to go
exactly as we all uh expect excellence
so that's how you can now turn dot twin into an asynchronous workflow
so let's comment out that and instead let's run this function down here tasks
so what am i doing here i'm creating a list of tasks i'm
iterating over them and i'm adding them all to the task list i'm not awaiting
them right so i'm not doing what i was doing up here i'm just letting them all
go and then i'm waiting for them all to
finish once they're all finished i'm then iterating over them and i'm
scaling them so now i'm using an async workflow to handle all of my tweens
which in my opinion is much cleaner
obviously everyone's got their own preference right
some people like to use code routines over async
you might like to just use the sequences or just chaining them so and and really
i use this too sometimes like if there's nothing else relying on a tween or
something that has to happen after a tween i'll just use oncomplete
or if like the the method isn't an async workflow method i'll just use oncomplete
uh it's perfectly fine just use the best tool for the job
okay so the last one is uh just a few features that i would like
to brush over so
here we've got a uh jump function okay so this is do jump if i click it
you'll see that it does a jump so let me show you what that is like so
i've got a reference to my jumper here and i'm just saying do jump jump to this
place with this jump power so how high do you want to jump number of jumps one
uh and then you can also set the ease on it and as i'm saying to jump to this
location and i'm already there if i press it again it's just going to keep
jumping there there's shake here so basically what i'm doing is i am taking
my transform my shaker i'm shaking the position rotation and
scale and it kind of gives it like a little
bit of a jello feel one thing to keep note is that when you
press shake when you start these it's actually using the current position so
if you start it halfway through another shake you'll see that it uh
can start to get really out of out of whack
but i want one one thing to fix that is you can actually case your tween like
this so say you've got this say this is like a global method up here so then you
could say um if oops
if my tween is playing then don't do anything uh get out of it i don't want
to do anything until my my twin is finished
and also if you're about to destroy an object and it's actually got a tween
running on it you can say transform dot do kill and it will kill all the tweens
that are currently running before you destroy it
because uh dot twin has a safe mode so it won't
actually throw any crazy errors but but it will actually uh keep trying to
access the transform if a trend if a if a twin is active so always kill your
twins before you destroy the object do punch
is punching a position and i'll show you the code so just
puncher do punch and i'm this is local space so i'm saying punch two to the
left um you can add some vibration and some
elasticity to it and then as you can see my target is shaking and i'm doing that
at the right time by saying all right this is my duration of the punch
i'm setting a delay on this shake of the target by half the duration of the punch
so bam bam like pretty easy
so yeah easy way that's another chaining method really important one set delay uh
and the last one here change when i click it it just starts changing
the material of the mesh renderer's color at random so this is a reference
to the mesh renderer here material and i'm changing to a random
color every 0.3 seconds and then on the on complete method i'm recursively
calling it so this would just keep changing forever and ever and i could
keep pressing that and it's now trying to do like a whole bunch
of these recursively poor little computer
so yeah that's just a few extra functions and uh
there are heaps of things you can do with it for example you can grab your
camera and you could tween the field of view or the orthographic size you can
grab your audio source and tween the volume uh you can grab your sprite
render and change the color there's so many things you can do with it
and also just before i let you go there is uh
just basic uh float float and vector lerpings as well
so you could do do virtual float
right and then you could say from let's say 0 to
let's say 10 over three seconds this last one here will be the uh the
function that you want to do with the value so let's say it's uh it returns a
value and let's make an anonymous function here and we'll just say print
the value and also uh the good thing about this
doing it through dot tween is now we can actually add
uh an ease to it right we could set uh a bounce to it and we could also set our
loops right set loops whoops whoops minus one
and set that as yoyo so that will work as well
[Music] and as you can see down the bottom here
it's uh bouncing up to the thing and then back again
pretty cool and actually one last thing before i forget uh
say we say you've got a whole bunch of units right and they all need to move
and they're all in different areas but they all need to move to the same
location but you want them to all move at the same speed right you would
actually need to work out how far how far away they are from the
end result and then uh all move at different durations right
and that sucks so instead of that you can actually say
okay i want you to move [Music]
um let's just remove this stuff and let's just say i want i want our
transform to move across the across the way to 10 on the x
uh but now instead of duration let's say i
choose two on the duration here i can say now set speed based
and we'll just say true so this duration is not actually uh
working as a duration anymore it's not saying go from here to here in two
seconds it's now saying you can move two units every second does that make sense
so now all your units are all scattered and they're they're tons of different
distances away from the the target they can all move at the same speed as long
as you say set speed based equals true so
uh yeah so that's moving roughly two units
every second cool bananas so
that's all i wanted to show you uh that's dot twain i mean it is my
favorite library in the whole world so i hope you enjoyed learning about it uh if
you already knew about it i hope i taught you something new uh subscribe if
you haven't already i'll be releasing tons of juicy content never in this
freaking costume again because it's been annoying
and it's like giving me a headache but yeah that's it from me and i will see
you in the next video bye