Tip of the Day: Simple 2D Camera Shake in Unity

One of the best ways that increases player immersion in the game is a Camera Shake.

Camera shakes are especially useful for explosions, when player takes damage, or for collectibles.

If you are not using Cinemachine, here is a simple way to do it.

Start by creating a C# script call it CameraShake (or whatever you want) and attach it to your main camera.

Use this script to call the shake whenever you need. If you are up to the challenge then try writing the code from the above Pseudocode.

Here is the final result

One final note, to achieve best results when the main camera sets back to its original position you need to add child the camera in its own parent game object

A knowledge seeking biologist who is following his passion into a full time career in Unity / Game Development. https://www.linkedin.com/in/mohamed-hijazi/

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store