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...

To begin with, we will launch our new shader file that we just created and enter the code mentioned in the following steps:

  1. The shader will need two new properties that will allow us to control the speed of the texture scrolling. So, let's add a speed property for the X direction and a speed property for the Y direction, as shown in the following code:
Properties {  _Color ("Color", Color) = (1,1,1,1)  _MainTex ("Albedo (RGB)", 2D) = "white" {}  _ScrollXSpeed ("X Scroll Speed", Range(0,10)) = 2   _ScrollYSpeed ("Y Scroll Speed", Range(0,10)) = 2 }
  1. When working in ShaderLab, Properties has a syntax that looks like the following:
Properties{    _propertyName("Name in Inspector", Type) = value}

Each property contained in the Properties ...

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