Instance Method


Sets a value for the specified shader variable or attribute name, using subscript syntax.


- (void)setObject:(id)obj forKeyedSubscript:(id<NSCopying>)key;



An object containing a new value for the shader symbol.


A shader variable or attribute name used in one of the technique’s shader programs.


The value parameter should be an object appropriate to the type of the shader symbol being set. For example, use an NSNumber object to set the value of a float uniform variable, or use an NSValue object containing an SCNVector3 structure to set the value of a GLSL vec3 uniform variable or a Metal float3 variable.

Use this method when you need to set a value infrequently or only once. To update a shader value every time SceneKit renders a frame, use the handleBindingOfSymbol:usingBlock: method instead.

If you use the handleBindingOfSymbol:usingBlock: method to associate a handler block for a symbol, SceneKit ignores values set for the symbol using the setObject:forKeyedSubscript: method.

See Also

Handling Parameters for a Technique’s Shader Programs

- handleBindingOfSymbol:usingBlock:

Specifies a block to be called before rendering using programs with the specified GLSL uniform variable or attribute name.

- objectForKeyedSubscript:

Returns the value associated with the specified GLSL uniform variable or attribute name, using subscript syntax.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software