Easily Control Cameras with Cinemachine in Unity!

🌐 Get the Mega Bundle worth over $1000 for 90% off at assetstore.unity.com/?on_sale...
❤️ Using this Affiliate Link helps support the channel
✅ Let's check out Cinemachine in Unity, it's a Camera System that enables you to create complex camera behaviours with ease!
Working with Cinemachine Cameras
learn.unity.com/project/worki...
Character Controller in Unity 2D
• Character Controller i...
Sponsored by Unity
If you have any questions post them in the comments and I'll do my best to answer them.
🔔 Subscribe for more Unity Tutorials / @codemonkeyunity
See you next time!
📍 Support on Patreon / unitycodemonkey
🤖 Join the Community Discord / discord
📦 Grab the Game Bundle at unitycodemonkey.com/gameBundl...
📝 Get the Code Monkey Utilities at unitycodemonkey.com/utils.php
#unitytutorial #unity3d #unity2d
--------------------------------------------------------------------
Hello and welcome, I am your Code Monkey and here you will learn everything about Game Development in Unity 2D using C#.
I've been developing games for several years with 7 published games on Steam and now I'm sharing my knowledge to help you on your own game development journey.
You can see my games at www.endlessloopstudios.com
--------------------------------------------------------------------
- Website: unitycodemonkey.com/
- Twitter: / unitycodemonkey
- Facebook: / unitycodemonkey

Пікірлер: 94

  • @CodeMonkeyUnity
    @CodeMonkeyUnity4 жыл бұрын

    📦 Check out the Grow your skills Mega Bundle here: assetstore.unity.com/mega-bundles/grow-your-skills?aid=1101l96nj&pubref=cinemachinecom 🌐 Learn more about Unity Learn Premium here: bit.ly/39TZSuH ❤️ Using this Affiliate Link helps support the channel

  • @user-hz4tc2pf3x
    @user-hz4tc2pf3x4 жыл бұрын

    I LOVE this 2D-3D mix

  • @diliupg
    @diliupg4 жыл бұрын

    You made this tutorial on the same day I need to add 2 Cinemachine cameras to do exactly what you showed in the tute! Fab!

  • @thabanglekgetho4734
    @thabanglekgetho47344 жыл бұрын

    Awesome. Needed this. Thank you!

  • @neo-gio
    @neo-gio3 жыл бұрын

    You deserve so much more credits. Iam back into making games thanks to you!

  • @CodeMonkeyUnity

    @CodeMonkeyUnity

    3 жыл бұрын

    That's great to hear! Thanks!

  • @Oxmond
    @Oxmond4 жыл бұрын

    Great content! As always! 👍🤓

  • @Hezekiah188
    @Hezekiah1882 жыл бұрын

    Thank you so much! This was has helped me a lot

  • @justinwhite2725
    @justinwhite27254 жыл бұрын

    Omg thank you. Been wanting a good tut on this,

  • @hotsauce7124
    @hotsauce71242 жыл бұрын

    Thank you for this, It really helped me out a lot.

  • @KillerGameDev
    @KillerGameDev3 жыл бұрын

    Amazing...absolutely amazing. Thanks! :D

  • @PedroJaimeCostaPereira
    @PedroJaimeCostaPereira4 жыл бұрын

    Keep up the pro work! 👍

  • @Alexander_Meyer
    @Alexander_Meyer4 жыл бұрын

    Hey, im an awesome supporter!! Good video as always!

  • @CodeMonkeyUnity

    @CodeMonkeyUnity

    4 жыл бұрын

    Thanks for your support!

  • @omagro8267
    @omagro82673 жыл бұрын

    subbed, notified and liked. U a g homie.

  • @hoseinabdl3263
    @hoseinabdl32634 жыл бұрын

    awesome like always.

  • @michaelvicente5365
    @michaelvicente53653 жыл бұрын

    very cool tut, I'm struggling to find where to remove the rotation tho, like if I want to retain some sort of isometric angle that is fixed

  • @deepblu7376
    @deepblu73762 жыл бұрын

    Thank you!

  • @Mikelica69
    @Mikelica693 жыл бұрын

    Thanks!

  • @MartinVaupell
    @MartinVaupell4 жыл бұрын

    Excellent, i need something like this for schow case trailer for a steam game.

  • @KMOONN
    @KMOONN4 жыл бұрын

    Thank you for the amazing videos!

  • @andrew.r.lukasik
    @andrew.r.lukasik4 жыл бұрын

    Did you noticed that there is also ZERO tutorials about programming Cinemachine?

  • @CodeMonkeyUnity

    @CodeMonkeyUnity

    4 жыл бұрын

    Yeah it's very designer focused. It took me a while to figure out how to modify the stats through code so maybe I'll cover that in a video.

  • @aarondelgado3421

    @aarondelgado3421

    4 жыл бұрын

    You can use cinemachine and trigger areas in which you use code to activate a specific cinemachine object when the player enters the trigger zone. That's one example of how you can use code for a cinemachine.

  • @AndrewMaksymBrainNectar

    @AndrewMaksymBrainNectar

    2 жыл бұрын

    @@CodeMonkeyUnity please do 👍

  • @CodeMonkeyUnity

    @CodeMonkeyUnity

    2 жыл бұрын

    @@AndrewMaksymBrainNectar I did cover one way to modify it through code here kzread.info/dash/bejne/c3eak6trZ6ychM4.html

  • @anormalguy8407

    @anormalguy8407

    2 жыл бұрын

    @@CodeMonkeyUnity thanks allot, i was struggling to find a way to change the target transform during runtime because the thing it needed to follow would be spawned when the game ran from an array of choices

  • @Dritix
    @Dritix3 жыл бұрын

    Nice video!

  • @aminemostefa922
    @aminemostefa9224 жыл бұрын

    Great channel

  • @RecOgMission
    @RecOgMission4 жыл бұрын

    Great. I've currently got a manual swivel and stick on my game camera. The movement is too choppy. I'm going to have a look at Cinemachine, since I'm going to have to produce some cut scenes eventually as well.

  • @JermaineMorgan
    @JermaineMorgan4 жыл бұрын

    INTERESTING!

  • @NikhilMahirrao
    @NikhilMahirrao4 жыл бұрын

    Can we use it with an orthographic camera to achieve an effect like the "Tiny Room" game?

  • @abhishekkumawat91
    @abhishekkumawat914 жыл бұрын

    awesome tutorial as always. can you make a tutorial on profiler to optimise the performance?

  • @CodeMonkeyUnity

    @CodeMonkeyUnity

    4 жыл бұрын

    Yeah the Profile is definitely something I'd like to cover but haven't found a good way to do it yet.

  • @MMonis-ge6lh
    @MMonis-ge6lh5 ай бұрын

    Hello Hugo, I am not able to implement it on third person can you please guide me ?

  • @baldipogchamp8926
    @baldipogchamp89263 жыл бұрын

    Hey there! I wanted to ask you, how did you make that 2d character in a 3d world but with a nice shadow? Sprites don't tend to have shadows or interact with light sources, I thought? Thank you :)

  • @CodeMonkeyUnity

    @CodeMonkeyUnity

    3 жыл бұрын

    The character is built using a MeshRenderer kzread.info/dash/bejne/Y2WXm9SQgtLaeps.html

  • @radiagulzan
    @radiagulzan3 жыл бұрын

    There are no tutorials on how to use the state driven camera for 2D anywhere online :( I tried to use it but it doesn't change the perspectives depending on the animations as it should, which is the whole point

  • @sabythenoob
    @sabythenoob3 жыл бұрын

    this Character controller looks awesome... I tried to create in 3d but light unable to cast shadows

  • @justinwhite2725
    @justinwhite27254 жыл бұрын

    Hey have you yet (or will you soon) do a video on how you got that lighting to work on the sprite-in-3D world? I’ve been going for a xenogearsv(and other mid ps1 era games) look, but always run into hiccougs with the lighting.

  • @CodeMonkeyUnity

    @CodeMonkeyUnity

    4 жыл бұрын

    I got it to work by using a Spotlight and Directional Light set to Realtime. If it's baked it can work with Light Probes. I did have tons of issues with lighting when making a mini-game that uses the mixed 3D and 2D world, so it's definitely not an area I'm very experienced in since up until now pretty much all of my work has been done in 2D.

  • @xingu2039
    @xingu20393 жыл бұрын

    I just search for a 3rd person overlook (view form top to bottom) cinamachine. And so it is 2d mode! Thx you!

  • @abhishekkumawat91
    @abhishekkumawat914 жыл бұрын

    When I play on Android smartphone, the pixels of sprites burst, how can I fix it, will you help me?

  • @leonardocafissi5580
    @leonardocafissi55802 ай бұрын

    why cinemachine doesn't work with Camera.main.pixelWidth? how can I fix it?

  • @suvsundrawingdiy1045
    @suvsundrawingdiy1045 Жыл бұрын

    You know what! You can just make the camera the child of the player. It works just perfectly and conserves more time

  • @CodeMonkeyUnity

    @CodeMonkeyUnity

    Жыл бұрын

    Hmm sure, making a first person camera is just one of the many possible use cases of Cinemachine. If that's all you want then sure I guess you don't need cinemachine at all.

  • @headrushgaming2614
    @headrushgaming26142 жыл бұрын

    is there a way to also move the camera slightly by moving the mouse? sort of like a micro pan across ? my best explanation of the thing i am looking for is the way little nightmares camera works

  • @CodeMonkeyUnity

    @CodeMonkeyUnity

    2 жыл бұрын

    You would just need some basic logic taking the mouse world position, checking the distance from the center of the screen and moving the object that the virtual camera is following towards that direction by some fraction of that distance.

  • @samirehman4565
    @samirehman45654 жыл бұрын

    I need a tutorial on how to bake lights on prefab, I'm working on a endless runner 2.5d where platforms are instantiate on run time can you do something like that script for it?

  • @samirehman4565

    @samirehman4565

    4 жыл бұрын

    @@bezoro2008 there's a online script that you can get for baking on prefab but result with is very bad, btw what you mean by "baking light in a level that is not preset and completly static? my platforms arre set to static and baking light is recommended for performance, tried real time and its taking lot of performance.

  • @mathildebeguinot8370
    @mathildebeguinot83704 ай бұрын

    Hello ! I know this video is old, but I got a problem with cinemachine... I set the virtual camera, assign the player in Follow and Look At just as you did, but in play mode when I move my player the camera rotate and spin around the player, keeping him at the center. Plss help me !

  • @CodeMonkeyUnity

    @CodeMonkeyUnity

    4 ай бұрын

    Look at the camera options, I don't remember the exact option but you want it set to Absolute position and not relative so that when it applies the offset 0,0,-10 it is always applying that offset in world space and not local space based on player rotation And make sure the virtual camera is not a child of the player

  • @prroni3694
    @prroni36944 жыл бұрын

    Hi love your vids. can u make a vid on celestes hair(i have 5 month im stcuk), i need to uderstand it so i cn make my game.

  • @dann5295
    @dann52954 жыл бұрын

    ECS! ECS!

  • @magictimm4090
    @magictimm40904 жыл бұрын

    Hey Code Monkey, the Affiliate Link is broken.

  • @troyna77
    @troyna77 Жыл бұрын

    does anyone know the codemonkey course that deals with the missing "PostProcessingVolume" script ? The unitypackage is playable BUT the player is just pink(Character>Body>Player outline(MArterial) > Legacy Shader "Pink Ball"). How do I convert the Texture -> (SwordTwoHAndedBack) to URP so I can see His player ?

  • @CodeMonkeyUnity

    @CodeMonkeyUnity

    Жыл бұрын

    Post processing in URP uses the Volume component and not the PP package unitycodemonkey.com/video.php?v=vmwdKK-GZDc Also textures don't require any conversion, only the shaders used by the material. The converter tool should fix every non-custom shader docs.unity3d.com/Packages/com.unity.render-pipelines.universal@12.0/manual/features/rp-converter.html

  • @adityajaiswal7158
    @adityajaiswal71583 жыл бұрын

    In pakage manager, I see Unity Registry, In Project, My Assets, Build In package. I cannot find all Assets option. And i search but did not gind cinemachine anywhere. Where could I find cinemachine.

  • @CodeMonkeyUnity

    @CodeMonkeyUnity

    3 жыл бұрын

    It's in the Unity Registry which are the official Unity packages

  • @adityajaiswal7158

    @adityajaiswal7158

    3 жыл бұрын

    @@CodeMonkeyUnity Thank you.

  • @fredtchiadeu1089
    @fredtchiadeu10892 жыл бұрын

    Hello, thanks for this usefull and awesome video as always. I have a question, in my Unity editor in playmode my cinemachine seems fine but when I make a build of my project it become very slow(😭) can someone help me please!!???

  • @CodeMonkeyUnity

    @CodeMonkeyUnity

    2 жыл бұрын

    Is it just the camera or your whole game is slow? Sounds weird that cienmachine would be what is slowing it down. Check the logs to see if you have any errors in the build kzread.info/dash/bejne/ZKiVm4-HY87cidY.html

  • @fredtchiadeu1089

    @fredtchiadeu1089

    2 жыл бұрын

    @@CodeMonkeyUnity hi, it's only the camera

  • @fredtchiadeu1089

    @fredtchiadeu1089

    2 жыл бұрын

    @@CodeMonkeyUnity there is no error in the build

  • @mohamedhazeem411
    @mohamedhazeem4114 жыл бұрын

    Can i create a gameplay with cinemachine without write a camera following script? Is it possible to make a gameplay?

  • @rhapen
    @rhapen3 жыл бұрын

    it does not make any sense to me but somehow the Lerp was counting up instead of down. so i switched the startingintensity with 0... but seriously it does not make sense.. but for some reason it works cinemachineBasicMultiChannelPerlin.m_AmplitudeGain = Mathf.Lerp(0f, startingIntensity, shakeTimer/shakeTimerTotal);

  • @CodeMonkeyUnity

    @CodeMonkeyUnity

    3 жыл бұрын

    If you are decreasing the third argument it will "count down", add a Debug.Log to see what the math is doing

  • @shivam100
    @shivam1004 жыл бұрын

    Can you make a video on 2d procedural generation ?

  • @CodeMonkeyUnity

    @CodeMonkeyUnity

    4 жыл бұрын

    I have thought about doing a Procedural Dungeon like I made for Survivor Squad

  • @aarondelgado3421

    @aarondelgado3421

    4 жыл бұрын

    @@CodeMonkeyUnity If you do such a tutorial, I'd definitely watch that one!

  • @watercat1248
    @watercat124815 күн бұрын

    this priority value is the reason i don't like Cinemachine because the mest up with all the camera's i have in my game instead to stay in whatever camera i wand to. I do not know why but with Cinemachine it very likely to mest up my cameras and those values are very confusing to my. the main reason i don't like Cinemachine it's exactly the reason you have said the have one camera activity at it time my game have the option to play split scenes that mean more the one camera that needs to be active. and don't wand the camera's to mest up and become active wean i don't want.

  • @anshulsingh8326
    @anshulsingh83263 жыл бұрын

    How to change camera priority using code?

  • @CodeMonkeyUnity

    @CodeMonkeyUnity

    3 жыл бұрын

    cinemachineVirtualCamera.m_Priority

  • @anshulsingh8326

    @anshulsingh8326

    3 жыл бұрын

    @@CodeMonkeyUnity Thanks❤️ Couldn't find it in documentation.

  • @williamwaap
    @williamwaap4 жыл бұрын

    el enlace de Get the Mega Bundle worth over $1000 for 90% off esta roto

  • @omagro8267
    @omagro82673 жыл бұрын

    How do i trigger a cinematic camera move if my player picks up a key? In other words, if i was to pick up a key i want the camera to pan over to the door it just opened in a 2d project. Thanks ahead of time for anyone with answers!

  • @omagro8267

    @omagro8267

    3 жыл бұрын

    NEVERMIND!!!!! Figured it out not but a minute later. Thanks again present me!

  • @omagro8267

    @omagro8267

    3 жыл бұрын

    YOURV WELCOME!

  • @RawHunterX
    @RawHunterX4 жыл бұрын

    Anyone has found a fix for when the Players velocity gets too high and the camera has problems catching up with the Player?

  • @CodeMonkeyUnity

    @CodeMonkeyUnity

    4 жыл бұрын

    What problems does it have? It should catch up immediately if the player goes into the red area.

  • @RawHunterX

    @RawHunterX

    4 жыл бұрын

    @@CodeMonkeyUnity In my experience, it happens when the Player jumps of cliffs for example and theres a long distance until it touches the ground. In that timeframe, the Y velocity of the player keeps increasing negatively that the camera eventually lags behind until the Player stops. Im thinking maybe the Gravity might be a factor. I am also implementing a WallJump ability and if I set the power too high, when the Player jumps off the Wall, it will be pushed in the opposite direction at a high speed that the camera again will have issues following the Player. I will play along more with the properties of the Camera. I am using a smooth damping atm, but that seems to be the issue when at higher speeds. I think that when there was no smoth damping, the camera was locked to the player. I havent got to that point yet, but Im thinking I might need smooth damping to make a Parallax Scorlling effect in the background.

  • @random_precision_software
    @random_precision_software4 жыл бұрын

    I am having trouble with a top-down camera I don't want the camera to rotate around the player

  • @CodeMonkeyUnity

    @CodeMonkeyUnity

    4 жыл бұрын

    If you just set the follow field it won't rotate, just like I showed at the end

  • @random_precision_software

    @random_precision_software

    4 жыл бұрын

    @@CodeMonkeyUnity See It pays to watch the whole video eh? LOL Thnx!

  • @chillclip1
    @chillclip14 жыл бұрын

    Can you focus in 3D Games ☺

  • @Yamto_J
    @Yamto_J3 жыл бұрын

    why am i the only who cant add cinemachine it doesn't even show

  • @CodeMonkeyUnity

    @CodeMonkeyUnity

    3 жыл бұрын

    What can't you do? You just need to install the package, that's it

  • @coffeegopher6740

    @coffeegopher6740

    3 жыл бұрын

    Make sure at the top of the Package Manager that you have "Packages: Unity Registry" selected instead of the default "Packages: In Project". Cinemachine should show up then.

  • @jeronimocollares320
    @jeronimocollares3202 жыл бұрын

    This is ridiculous, we dont have 1 single tutrial on web about change between cameras (using cinemachine and a simple key')...nothing, ZERO...

  • @CodeMonkeyUnity

    @CodeMonkeyUnity

    2 жыл бұрын

    You just change the priority, that's it. It will smoothly interpolate all the values when another camera has a higher priority

  • @jeronimocollares320

    @jeronimocollares320

    2 жыл бұрын

    @@CodeMonkeyUnity hey, about change the camera WITH a key (like Ooti cam). :)

  • @jeronimocollares320

    @jeronimocollares320

    2 жыл бұрын

    @@CodeMonkeyUnity I post it on Unity Forum, Cinemachine session - about it and mouse lock. *