O'Reilly logo

Unity 2018 Shaders and Effects Cookbook by Alan Zucconi, John P. Doran

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to do it...

With all of our assets gathered and the screen effect system running smoothly, let's begin to add the code necessary to both the script and shader. We will begin our coding with the RenderNightVision.cs script, so double-click on this file now to open it in your code editor of choice:

  1. We will begin by entering the code in our script. Our first step in modifying our script is to rename the class to match our filename, RenderNightVision:
[ExecuteInEditMode]public class RenderNightVision : MonoBehaviour {
  1. We need to create a few variables that will allow the user of this effect to adjust it in the script's Inspector. Enter the following code in the NightVisionEffect.cs script:
#region Variables public Shader curShader; public ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required