How can I debug "Cannot add an uniform after UBO has been created"

I made some relatively small changes to my code and started seeing hundreds of these errors - and of course my code no longer works. The errors occur inside of scene.render() and the stack trace is not helpful at all.

Does anyone understand what causes this error and how I can track down the issue.


That’s going to be hard to help without a repro…

This error means a uniform buffer has been created with a given layout and a new uniform property has been added to it later, which is not valid as the layout of a uniform buffer is not allowed to change after creation. This probably should not happen if you use the libary “normally”. Have you tried with different versions of Babylon?

The game is 10s of thousands of lines of code and hundreds of asset files.
I did build a Playground once before that was only a couple of thousand lines of code, but it was hard for me to get it down to this size and still be representative of the game enough to illustrate the problem.

If I revert to my prior Git check in, that still works, so it’s something in the last commit, but it all looks very harmless.

I am not doing anything “unusual” with Babylon - deliberately sticking to the documented API to avoid future compatibility problems.

I have no idea what a uniform buffer is or a uniform property and have never worked directly wit these things.

Maybe you can try to revert to the state that works and add the new things by small increment until it fails, if that is possible?