Description
The ForceRecompile
property is a boolean flag within the ShaderCompileOptions
struct. It indicates whether the shader should be forcibly recompiled, regardless of any existing compiled versions. This can be useful during development when changes to shader code need to be immediately reflected without relying on cached versions.
Usage
To use the ForceRecompile
property, create an instance of ShaderCompileOptions
and set the property to true
if you want to ensure that the shader is recompiled. This is particularly useful in scenarios where shader code is frequently updated and you want to bypass any cached versions.
Example
// Example of using ShaderCompileOptions with ForceRecompile
ShaderCompileOptions options = new ShaderCompileOptions();
options.ForceRecompile = true;
// Use options in shader compilation process
Shader myShader = new Shader("path/to/shader");
myShader.Compile(options);