Unity3D: Camera Shake Effect with C# Example

One of my unfinished Unity3D game projects required camera shaking function, so I wrote one from scratch.

I just needed a script that shakes camera for a certain time and magnitude, and can be called from other script. Also, sometimes it would be useful to trigger this from UI button using OnClick().

Added 9.10.2018: This script is now available also at GitHub:
https://github.com/jliias/CommonUnityScripts/blob/master/CameraScripts/ShakeCamera.cs

Please find script below:

Script is added as a script component to the Camera type object and then it should be ready for use. You just have to figure out how and when to trigger it in your own game.

I hope that someone will find this script snippet useful!

-Jussi

Comments

  1. Thank you for sharing your thoughts and knowledge on this topic. This is really helpful and informative, as this gave me more insight to create more ideas and solutions for my plan. I would love to see more updates from you.

    Melbourne Web Developer

    ReplyDelete
  2. I am impressed with the post which you have shared. The blog you have shared is incredibly helpful. The tips you have shared related to web development is really informative. Thanks for sharing this blog!
    Unity 3D Game Development Services

    ReplyDelete

Post a Comment

Popular posts from this blog

Unity3D: Convert Seconds to hh:mm:ss Format

Construct 2: if-then-elseif-else statement

Issue with Unity3D: "Found plugins with same names, and ."