Posts

Showing posts from December, 2017

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