0
Under review

Time node operates at double speed in editor when Shader Forge window is open.

Ian McConville 8 years ago updated by Freya Holmér (Developer) 8 years ago 1

All animated materials in the editor view operate at double speed when the Shader Forge window is open. As soon as it's closed, all time reverts to it's natural speed.

Under review

This is a known issue.


In case you wonder as for why it happens - if your scene view doesn't have "animate materials" checked, the shader variable _Time won't increase, which means nothing will animate, not even in Shader Forge. The way I partially solved it was to, in the shader, write _Time + _EditorTime, and in Shader Forge simply set the _EditorTime variable every frame. (_Time can't be manually set)

Now, the result of this is that if animate materials is checked (or the game is running), and SF is open, it will run at twice the speed. Ideally, the shader should only have the unity _Time variable, but then you won't be able to see things animate in SF unless it tells the user to enable "animate materials".


It might be possible to force animate materials on, or add a little prompt/notification with a button, but even then, it might mean that if the scene view is hidden, _Time still won't be set.


So yeah, there's no straightforward solution. Perhaps the best middleground would be to detect if the scene view is visible, has animate materials checked, or if the game is running, and simply stop incrementing _EditorTime in that case. Though I worry that there may be edge cases where it won't animate.