After upgrading from 2020.1 to 2020.2 all my shader graphs work fine in play mode but now throw tons of errors when viewed in the editor…
after further inspection it appears that the check “#if SHADERGRAPH_PREVIEW” no longer works in 2020.2 / Shader Graph 10.2.2.
Is its removal intended? I don’t understand why this would be removed…
If so what’s the new method of making custom functions behave differently in preview mode vs play mode?
#Edit: I found a really buried thing where unity devs said they changed #if to #ifdef for some reason…
This thread can be deleted I guess. However I don’t see the option to delete it.
6 Likes
The mods on purpose don’t let you delete the thread, because someone else will hit the same issue, google it, find your thread, and benefit from your helpful information you’ve provided to the community on this issue.
3 Likes
@SaturnCO do you have more info on “changing #if to #ifdef”? I think I ran into this same issue and would love to know more.
1 Like
RESOLUTION NOTE:
The definition was changed to use “#ifdef” instead to match other keywords used by each Render Pipeline. This will be noted in the upgrade document when the next version is verified released.
2 Likes
Is this broken again in 2022.3.21f1?
This doesn’t seem to work…
#ifdef SHADERGRAPH_PREVIEW
Time = _Time.x * PreviewSpeed;
#else
Time = In;
#endif