Hi everyone,
I’m working with Cocos Creator 3.8.6, and I’ve encountered a problem: I’m trying to assign a Material to a Node.
In the editor (inside Cocos Creator), everything looks fine — the Node is visible and the Material is applied correctly.
However, when I run the project in the browser for testing, I always get the following error in the console:
[.WebGL-0x514c076fc700] GL_INVALID_OPERATION: glDrawElements: It is undefined behaviour to have a used but unbound uniform buffer.
Also, the Node with the Material is either not visible at all or appears completely transparent — I’m not sure.
I tried using a .mtl with both the standard .effect and a custom .effect, but there was no difference. It always displays correctly inside the Cocos Creator editor, but not in the browser, and the same error appears in the console.
As a last attempt, I tried using an .effect without any uniform blocks:
CCEffect %{
techniques:
- name: opaque
passes:
- vert: legacy/main-functions/general-vs:vert # builtin header
frag: unlit-fs:frag
properties: &props
mainTexture: { value: white }
}%
CCProgram unlit-fs %{
precision highp float;
#include <legacy/output>
in vec2 v_uv;
uniform sampler2D mainTexture;
vec4 frag () {
vec4 col = texture(mainTexture, v_uv);
return CCFragOutput(col);
}
}%
but it still didn’t help — again, it worked inside Cocos Creator but not in the browser, and I got the same error.
What do I need to do to correctly use Materials (and custom effects) with my Nodes?