Hey, I've been trying out shadergraph and shader programming in general and noticed shadergraph doesn't have any unscaled time options, also I haven't found many solutions on using unscaled time on shader codes, I searched on the forum and found something from 2015 saying it isn't possible to use unscaled time on shadergraph, is that still true? what would be a good method to make a shader run on unscaled time easily? Edit: Just to inform everyone, I animate a lot of my pause scenes with shaders, that's why I need them to act even when time is freezed, they're like background scrolling textures etc.
Indeed. To elaborate on that approach, add something like public Renderer ren; to a component and drag whichever to it. Add a Float property to your Shader Graph, call it something like "Unscaled Time" with a reference name like "_UnscaledTime". Then in Shader Graph, connect your Unscaled Time node to whatever, and finally in Update of the component you added ren to: Code (CSharp): ren.sharedMaterial.SetFloat("_UnscaledTime", Time.unscaledTime); Note the above expects the renderer is using a single material. If not, use .sharedMaterials[index] instead.
Thanks for teaching me on how to do it! Just had to do some changes as UI images doesn't have renderers aparently, but just had to change the code to: Code (CSharp): img.material.SetFloat("_UnscaledTime", Time.unscaledTime); Thank you so much again.
I need my scaled time for seasonal and day/night synchronization, and am using GPUI, (a GPU instancer) so I cant set the parameters outside of the GPUI prefab, because it all gets cached on the GPU, but I still want my trees to sway in the wind when paused. Not a huge deal, btu I think I might want it for other things in the future.
Magic words is what I seek! Thank you! Did not know the phrase existed. I will try it out. If it works, A whole new set of options just opened up! If I am reading it right, I can set all types of global floats for anything... ...wow. I did not even consider it possible when designing.