A container for uniform shader data.
- iOS 8.0+
- macOS 10.10+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
SKUniform object is used to hold uniform data for a custom OpenGL or OpenGL ES shader. The uniform data is accessible from all shaders that include the uniform.To use a uniform variable in your shader, create the
SKUniform object and set its initial value. Once its value is specified, the
uniform property changes to match the type of the initial value you provided and can never change afterward. To use the uniform object, add it to an
SKShader object that needs to access the uniform variable. To update the uniform variable’s value, choose the appropriate property on the uniform object based on the data type it encapsulates.