How to do it...

Adding a texture to your model using the Standard Shader is incredibly simple, as follows:

  1. In the Sample Code for this chapter that's provided with this book, you can find the basicCharacter model which, by default, has UV information embedded into it, making it so that when we attach a material, it will draw the texture using that information.
  2. Create a new Standard Surface Shader called TexturedShader by going to the Project tab and then selecting Create | Shaders | Standard Surface Shader. Once created, you can type in a new name for the shader and then press Enter.
  3. For organization's sake, open the shader and change the first line to the following:
Shader "CookbookShaders/Chapter03/TexturedShader" {
  1. This will allow ...

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.