- Home /
Is there any class, function, or variable available from a unity shader to get either system time or real time.
So I have been researching for the past few hours and have had no luck finding anything related to a way to get the system time or the real current time from a unity shader. I know how to do it through normal unity c# but that is inaccessible to the project I am doing. I would love any tips, pointers or even little clues to what I could do. Thanks in advance.
Answer by Bunny83 · Dec 05, 2021 at 05:02 AM
Shaders in general don't access anything. Shaders are given things by the engine / game code. Unity by default provides the built-in "_Time" variable which holds several scaled versions of Unity's Time.timeSinceLevelLoad. Those and the the other variables (_SinTime, _CosTime and unity_DeltaTime) are the only time related variables that are provided. You can not "request" any information in a shader that is not provided from the game / C#
Well this is all I was curious about. I could not confirm if that was the case or not. Is it possible to pass real time to the shader without c#. I know that there is some include files that shaders can take so I was curious if there was any way to use those to pass real time to the shader