slipster216 / PlayableShaderGlobals

Allows you to easily add new shader globals to the Timeline feature in unity 2017
MIT License
59 stars 10 forks source link

Playable Shader Globals

This system makes is incredibly easy to add global shader properties to the Timeline in Unity via Scriptable Objects. Lets imagine you have wind strength, and many shaders and C# systems want to read the wind strength. In unity, you can easily set and get this value via c# code like so:

Shader.SetGlobalFloat("gWindSpeed", 1.0f);

float curWindSpeed = Shader.GetGlobalFloat("gWindSpeed");

And in a shader, you can use this value by NOT declaring a property for it, and just declaring the value itself:

float gWindSpeed;

This allows you to easily write shaders and systems which interact with this value without having to manage materials and singletons.

What Playable Shader Globals does is allow you to easily add these global shader values to timeline animations. To do so, install this repository and:

To create a new Global Property:

To use the Global Property in Timeline