Editor/UpgradedShaderGraph/Nodes/BaseNodes/Time.cs

An editor-only Shader Graph node named Time. It exposes a float Value initialized from RealTime.Now and provides an output NodeResult.Func that returns a time variable name depending on whether the graph is a preview or not.

Obfuscated Code

namespace Editor.ShaderGraphExtras.Nodes;
/// <summary>
/// Current time
/// </summary>
[Title( "Time" ), Category( "Variables" ), Icon( "timer" )]
public sealed class Time : ShaderNode
{
	[JsonIgnore]
	public float Value => RealTime.Now;

	[Output( typeof( float ) ), Title( "Time" )]
	[Hide]
	public NodeResult.Func Result => ( GraphCompiler compiler ) =>
	{
		return new NodeResult( 1, compiler.IsPreview ? "g_flPreviewTime" : "g_flTime", compiler.IsNotPreview );
	};
}