Get an 20% OFF using the RELEASE code on your book purchase. For a limited time.

Introduction to the shader programming language

3.0.5. Color and Vector Properties

This post is also available in…

With this property, we can define colors and vectors in our shader. 

We are going to suppose that we want to create a shader that can change color in execution time, for this we would have to add a color property where we can modify the RGBA values ​​of the shader.

To declare colors and vectors in our shader use the following syntax:

// name (“display name”, Color) = (R, G, B, A
// name (“display name”, Vector) = (0, 0, 0, 1)

Shader “InspectorPath / shaderName”
        _Color (“Tint”, Color) = (1, 1, 1, 1)     
        _VPos (“Vertex Position”, Vector) = (0, 0, 0, 1)

In this previous example we declared two properties, a “color” called _Color and a “vector” called _VPos.

Follow us to stay informed about all the latest news, updates, and more.

Join the group to share your experiences with other developers.

Subscribe to our channel and keep learning game dev!


Jettelly Team

We are a team of indie developers with more than 9 years of experience in video games. As an independent studio, we have developed Nom Noms in which we published with Hyperbeard in 2019. We are currently developing The Unity Shader Bible.

Follow us on our social networks.