Phaser API Documentation

  Version: 
setUniform(key, value)

Description:

Sets a property of a uniform already present on this shader.

To modify the value of a uniform such as a 1f or 1i use the value property directly:

shader.setUniform('size.value', 16);

You can use dot notation to access deeper values, for example:

shader.setUniform('resolution.value.x', 512);

The change to the uniform will take effect the next time the shader is rendered.

Parameters:

name type description
key string

The key of the uniform to modify. Use dots for deep properties, i.e. resolution.value.x.

value any

The value to set into the uniform.

Returns:
Description:

This Shader instance.

Since: 3.17.0