Learn how you can easily fade out objects that are using the standard URP shaders that obstruct view to the player using C# code!
In this tutorial you'll see how to determine which material properties to adjust for the standard URP shaders:
⚫ Universal Render Pipeline/Lit
⚫ Universal Render Pipeline/Complex Lit
⚫ Universal Render Pipeline/Simple Lit
⚫ Universal Render Pipeline/Unlit
⚫ Universal Render Pipeline/Baked Lit
as well as learn the process to determine which properties to modify for any other shader when documentation is lacking!
In my tests this performs on average, 0.04ms per frame with the code here, which is, in my opinion, for most cases "good enough" performance to use when you do not know how to make a shader to do this, or just want to keep using the standard URP shaders.
As always, all code from this video is available on GitHub: https://github.com/llamacademy/urp-fading-standard-shaders
Using the Built-In Render Pipeline? It's a very similar process. Check out this GitHub repository: https://github.com/llamacademy/fade-objects-standard-shader with accompanying video tutorial:https://www.youtube.com/watch?v=dIC4wbUgt5M for the same effect, but for the Built-In Render Pipeline.
📱 Let's stay connected
YouTube: https://youtube.com/c/LlamAcademy
Patreon: https://www.patreon.com/llamacademy
Facebook: https://facebook.com/LlamAcademyOfficial
Twitter: https://twitter.com/TheLlamAcademy
TikTok: https://tiktok.com/@LlamAcademy
Instagram: https://instagram.com/LlamAcademy
----
Believe in LlamAcademy's mission and have received value from the videos? Consider becoming a Patreon supporter: https://www.patreon.com/llamacademy
----
Most tutorials come from knowledge gained making https://survival.llama.software Llama Survival - a top-down zombie survival shooter for Android and iOS.
I also have some Unity Assets (affiliate link): https://assetstore.unity.com/publishers/22409?_aid=1101l9QvC
#unitytutorial #tutorialtuesday #gamedev #tutorial #unity #llamacademy #gamedevelopment
Chapters:
00:00 Topic Introduction
01:45 URP Standard Shader Inspection
03:28 Scene Setup
03:50 FadingObject.cs - Control Which Renderers to Fade
05:49 Variables - FadeObjectsBlockingObject.cs
07:28 Check For Objects Blocking Player - FadeObjectsBlockingObject.cs
11:03 Fade an Object OUT - FadeObjectsBlockingObject.cs
13:53 Fade an Object IN - FadeObjectsBlockingObject.cs
17:41 Set up in Inspector & Demo
18:43 Closing Thoughts