Let's create a smooth follow camera script in Unity! We will create a script where the main camera can follow the player or any specified target. We will also look into scenarios where we have to switch the target, or even pause the follow. We will also deal with getting references at runtime and null reference exceptions along the way!
Download the script and the project files here 👇
https://github.com/AnanD3V/Smooth-Fol...
Learn how to create the Player Controller here 👇
• 2D Platformer Movement in Unity | New Inpu...
Learn more about Vector3.SmoothDamp here👇
https://docs.unity3d.com/ScriptRefere...
For doubts and stuff, join our discord club👇
/ discord
Behold the timestamps 👇
0:00 | Really short Intro
0:16 | Project setup
0:39 | Camera as a child of the player
1:02 | Recommending Cinemachine/External Packages
1:50 | Creating FollowTarget script
3:13 | Update or LateUpdate for camera?
5:57 | Linear follow camera (Not smooth)
7:47 | Smooth follow camera
12:02 | What if the player is spawned at runtime?
15:10 | What if the target is null?
17:38 | Intro Sequence? (PART 2 Video)
18:14 | Really boring Outro
#unity3d #gamedevelopment #tutorials #unitytutorial
If you have any questions, put down a comment below, and I will try to answer them to the best of my knowledge.
Thank you for watching the video and reading this description. Take care.