If you need any extra information you can use to help, I’m working Unity 2023.2.0 with an HDRP project. What I’m trying to do is to create a simple static effect that creates a psuedo-random value for each pixel, and refreshes the pixels based on time each frame. I’m new to HLSL but I dont think this should be way too hard of a shader to make. I’m using this shader from Shadertoy to copy into HLSL so I at least have an understanding of how the values are generated and refreshed.
I am aware that there may be errors aside from this one inside of the code, you’re welcome to fix them and tell me how you fixed them so that I may know later. Thanks, cs5947
Unlike in C#, you can’t declare properties with an initial value, linking to yet another property. The error hints at this, but it’s really asking you to make the value a constant.
You can:
Declare it as a local property in the CustomPostProcess function
Change it to a macro (#define time _Time.x) (no semicolumn at the end!)
Replace the usage of the ‘time’ variable with ‘_Time.x’.
Have you noticed the “Hash” function is also nested in the CustomPostProcess function? That needs to be moved up outside of the function’s scope.
Side note: best to replace ‘_Time’ with ‘_TimeParameters’. The former is legacy code, whilst the latter is the SRP standard.