Impact Effects with Scriptable Objects




Published: 05 Apr 2022

A common need in video games, to increase immersion of the player, is to add some effect when an impact is made. Using this system whenever an impact is made by any arbitrary action in your game, you can simply call SurfaceManager.Instance.HandleImpact() and this system will utilize Scriptable Objects to determine which effects to play. This allows you to have a highly configuration-driven surface management system where you can reuse effects across different impacts when that makes sense, and easily add/change effects when you want a unique effect!


This week is a little more advanced than I typically do. You can learn how to implement a surface management system that centralizes the control of impacts into a single script that is completely configuration driven (via ScriptableObjects). You'll learn how you can use it to create new Surfaces, Impact Types, and even extend more SurfaceEffects than just SpawnObjectEffect and PlayAudioEffect (that's all that's included in this video).


πŸ‘©β€πŸ’» As always, all code from this video is available on GitHub: https://github.com/llamacademy/surface-manager


🏷️Save 25% on the ultimate C# IDE: JetBrains Rider with code LLAMACADEMY: https://www.jetbrains.com/store/?section=personal&billing=yearly


πŸŽ₯ If you want more explanation on how the Click to Shoot was implemented, check out the Bouncing Bullets video: https://youtu.be/GkStW8-Q5P0


πŸŽ₯ For a more detailed explanation and walkthrough on how to get the active textures on a terrain check out this video: https://youtu.be/YX8E1AE3BYs


πŸ”Š Gun and impact sound effects in this video came from the Universal Sound Effects asset, which has over 1,000 reviews and a 5 star rating on the asset store (Affiliate link): https://assetstore.unity.com/packages/audio/sound-fx/universal-sound-fx-17256?_aid=1101l9QvC


πŸ’₯Particle Systems, Decals, and Textures came from the Unity Particle Pack (free): https://assetstore.unity.com/packages/essentials/tutorial-projects/unity-particle-pack-127325?_aid=1101l9QvC


🧑 Believe in LlamAcademy's mission and have received value from the videos? Here's how you can show your support:

🌟 Patreon: https://www.patreon.com/llamacademy

🌟 YouTube Member: https://www.youtube.com/channel/UCnWm6pMD38R1E2vCAByGb6w/join or click the Join button on any video

πŸ“š Take my Unity ShaderGraph Course:

https://www.gamedev.tv/p/unity-shader-graph?affcode=45216_kuvg0bp7

πŸ‘• Get yourself some LlamAcademy merch: https://llamacademy.myspreadshop.com/

πŸ’Έ Use my Affiliate Link for Humble Bundles https://humblebundleinc.sjv.io/9g4ak4

πŸ’Έ Publisher Sale! 50% OFF an entire publisher's Assets! Publisher changes weekly! https://assetstore.unity.com/publisher-sale?aid=1101l9QvC (affiliate)

πŸ’Έ Save up to 50% on NEW Assets: https://assetstore.unity.com/?new_sale=true&orderBy=1&aid=1101l9QvC (affiliate)


Some links may be affiliate links, which at no additional cost to you, gives me a small portion of the purchase.


Connect on Social Media

Some links may be affiliate links, which at no additional cost to you, gives LlamAcademy a small portion of the purchase.