# Cannot use \`uint\` uniforms in shaderMaterial

**URL:** <https://forum.babylonjs.com/t/cannot-use-uint-uniforms-in-shadermaterial/43998>\
**Category:** Questions\
**Tags:** shader, shader-material\
**Created:** [September 10, 2023, 4:27pm UTC](https://forum.babylonjs.com/t/cannot-use-uint-uniforms-in-shadermaterial/43998 "2023-09-10T16:27:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shubidumdu](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/shubidumdu/32/34933_2.png) [@Shubidumdu](https://forum.babylonjs.com/u/Shubidumdu)\
**Post date:** [September 10, 2023, 4:27pm UTC](https://forum.babylonjs.com/t/cannot-use-uint-uniforms-in-shadermaterial/43998/1 "2023-09-10T16:27:36Z")

</div>

Hi, this is my first time writing to this forum to ask a question. 🙂

I’ve been trying a few things with `ShaderMaterial`, and the only time I run into the error is when I try to use a uniform of type `uint` by `setUInt`.

The link below is a simple playground to reproduce the problematic situation.

> **[Babylon.js Playground](https://playground.babylonjs.com/#5T8G3I%2389)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

Here, I’m passing `5` as a uint uniform, and checking that value through the `for` statement to modify the color.

I think at least the box shouldn’t be black, but right now it’s literally just showing me a black box with the following error.

```plaintext
[.WebGL-0x11c00deab00] GL_INVALID_OPERATION: Uniform type does not match uniform method.

```

I’m not sure what the reason is. Did I miss something or is it a bug? I’ve spent quite a bit of time trying to figure out the problem, but I’m at a loss.

Any help would be greatly appreciated, thank you. 😊

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [September 11, 2023, 10:57am UTC](https://forum.babylonjs.com/t/cannot-use-uint-uniforms-in-shadermaterial/43998/2 "2023-09-11T10:57:45Z")

</div>

Welcome aboard!

Congrats, you’ve hit your first bug! 🙂

Here’s the fix:

> <https://github.com/BabylonJS/Babylon.js/pull/14285>
>
> See https://forum.babylonjs.com/t/cannot-use-uint-uniforms-in-shadermaterial/439…98

Note that you can use a signed int instead, which is not bugged.

---

<div class="post-metadata">

**Author:** ![Shubidumdu](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/shubidumdu/32/34933_2.png) [@Shubidumdu](https://forum.babylonjs.com/u/Shubidumdu)\
**Post date:** [September 11, 2023, 12:41pm UTC](https://forum.babylonjs.com/t/cannot-use-uint-uniforms-in-shadermaterial/43998/3 "2023-09-11T12:41:08Z")

</div>

Thanks for the reply and the fix! 🙂
