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

Get Unity 2018 Shaders and Effects Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.