onBeforeCompile runs every frame?

So I’m using the onBeforeCompile callback and it seems to be getting hit every frame! Is this expected behaviour or have I been a baaad programmer and done something particularly stupid?

Was just expecting it to be hit once.

Depending on your scene configuration, onBeforeCompile() can indeed run per frame. This is a bug and it could be fixed with the following PR.

I hope it can be merged in the next dev cycle. Please feel free to upvote or comment at the PR in order to give it a higher priority.

1 Like

Well that’s a relief… thought I was doing something daft that might have caused it to execute every frame.

I’ve decided to go down the route of creating my own shader material instead, since it looks like I’ll need both a custom vertex and frag shader, rather than just a custom vertex shader as I had previously.