ProtectedconstructorCreates a new MaterialPropertyBlock
The object this property block is for (optional)
The object this property block is attached to
Gets all property overrides as a readonly array
Array of all property overrides
Removes all property overrides from this block
Remove a shader define
The define name to remove
Disposes this property block and cleans up associated resources. After calling dispose, this property block should not be used.
Gets the override for a specific property with type-safe value inference
The property name to get
The PropertyBlockOverride with correctly typed value if it exists, undefined otherwise
const block = MaterialPropertyBlock.get<MeshStandardMaterial>(mesh);
// Value is inferred as number | undefined
const roughness = block.getOverride("roughness")?.value;
// Value is inferred as Color | undefined
const color = block.getOverride("color")?.value;
// Value is inferred as Texture | null | undefined
const map = block.getOverride("map")?.value;
// Explicitly specify the type for properties not on the base material type
const transmission = block.getOverride<number>("transmission")?.value;
// Or use a more specific material type
const physicalBlock = block as MaterialPropertyBlock<MeshPhysicalMaterial>;
const transmissionTyped = physicalBlock.getOverride("transmission")?.value; // number
Gets the override for a specific property with type-safe value inference
The property name to get
The PropertyBlockOverride with correctly typed value if it exists, undefined otherwise
const block = MaterialPropertyBlock.get<MeshStandardMaterial>(mesh);
// Value is inferred as number | undefined
const roughness = block.getOverride("roughness")?.value;
// Value is inferred as Color | undefined
const color = block.getOverride("color")?.value;
// Value is inferred as Texture | null | undefined
const map = block.getOverride("map")?.value;
// Explicitly specify the type for properties not on the base material type
const transmission = block.getOverride<number>("transmission")?.value;
// Or use a more specific material type
const physicalBlock = block as MaterialPropertyBlock<MeshPhysicalMaterial>;
const transmissionTyped = physicalBlock.getOverride("transmission")?.value; // number
Checks if this property block has any overrides
True if there are any overrides set
Removes a specific property override
The property name to clear
Set a shader define that will be included in the program cache key. This allows different objects sharing the same material to have different shader programs.
Defines affect shader compilation and are useful for enabling/disabling features per-object.
The define name (e.g., "USE_LIGHTMAP", "ENABLE_REFLECTIONS")
The define value (typically a boolean, number, or string)
Sets or updates a material property override. The override will be applied to the material during rendering.
Sets or updates a material property override. The override will be applied to the material during rendering.
The name of the material property to override (e.g., "color", "map", "roughness")
The value to set
OptionaltextureTransform: TextureTransformOptional UV transform (only used when value is a Texture)
StaticgetGets or creates a MaterialPropertyBlock for the given object. This is the recommended way to obtain a property block instance.
The object to get/create a property block for
The MaterialPropertyBlock associated with this object
StatichasChecks if an object has any property overrides
The object to check
True if the object has a property block with overrides
MaterialPropertyBlock allows per-object material property overrides without creating new material instances.
This is useful for rendering multiple objects with the same base material but different properties
(e.g., different colors, textures, or shader parameters).
The property block system works by:
Common use cases:
Getting a MaterialPropertyBlock
Important: Do not use the constructor directly. Instead, use the static MaterialPropertyBlock.get method:
This method will either return an existing property block or create a new one if it doesn't exist. It automatically:
Example: Basic usage
Example: Lightmap usage
Example: See-through effect