Material¶
54 tools for materials, material instances (constant and dynamic), material functions and layers, parameter collections, post-process materials, Substrate, compiling and stats.
Back to the index.
add_collection_parameter¶
Destructive
Add a scalar or vector (RGBA color) parameter with a new GUID to a Material Parameter Collection asset and save it; a new parameter changes the collection layout, so the engine recompiles the materials that use the collection. An existing parameter of that name and kind only gets its default overwritten (already_existed=true). The kind is param_type, or inferred from default_value: an [r, g, b, a] array means a vector, anything else a scalar. Returns the count before and after for that kind, the default and the id. A failed save makes success false with saved=false and save_error, the change kept in memory. Change a default later with set_collection_parameter_default; read back with get_collection_info.
| Parameter | Type | Required | Description |
|---|---|---|---|
collection_path |
string | yes | Full /Game path to the MPC asset |
param_name |
string | yes | Name of the new parameter |
param_type |
string | no | Optional "scalar" or "vector"; default inferred from default_value (an array -> vector, else scalar). Any other value is an error |
default_value |
any | no | Scalar: default float value, default 0. Vector: [r, g, b, a] floats, default [0, 0, 0, 1]; a shorter array keeps 0 for missing color channels and 1 for alpha. An existing parameter of that name gets this value too, even when it is omitted |
Returns: { collection_path: string, param_name: string, param_type: string, param_added: bool, already_existed: bool, scalar_count_before?: int, scalar_count?: int, default_value?: number (scalar), vector_count_before?: int, vector_count?: int, default?: {r,g,b,a}, default_rgba?: [number] (vector), id: string, saved: bool }
add_material_attribute_layers_node¶
Additive
Adds a new MaterialAttributeLayers expression to a UMaterial asset, turns on bUseMaterialAttributes (the separate pins such as Base Color stop driving the material), wires the node into MaterialAttributes, recompiles and saves. Not idempotent: each call adds another node. Fails when the save fails; returns connected_material_attributes and num_expressions. Unwire: disconnect_pin node_id=@output, pin_name=MaterialAttributes.
| Parameter | Type | Required | Description |
|---|---|---|---|
material_path |
string | yes | Object path to the UMaterial, e.g. /Game/MyGame/M_Example |
node_name |
string | no | Label echoed back in the reply only; it does not name or find any node in the graph |
Returns: { material_path: string, expression_added: bool, expression_class: string, connected_material_attributes: bool, use_material_attributes: bool, num_expressions: int, recompiled: bool, saved: bool, node_name: string, save_error: string }
add_material_function_call¶
Additive
Insert a call to a UMaterialFunction into a UMaterial graph: a MaterialFunctionCall node bound to the function, so the function's inputs and outputs become the node's pins. Refused, with the node removed again, when the function cannot be called from this material. The call fails when the new node is not among the material's expressions, bound to the function, after the recompile.
| Parameter | Type | Required | Description |
|---|---|---|---|
material_path |
string | yes | Full asset path of the UMaterial (e.g. '/Game/MyGame/M_Example') |
function_path |
string | yes | Full asset path of the UMaterialFunction to call (e.g. '/Game/Functions/MF_Foo.MF_Foo') |
node_name |
string | no | Optional name for the new node; a name another object of the material already has gets a unique variant |
Returns: { material_path: string, function_path: string, node_name: string, node_class: string, expression_count: number, success: bool, error?: string }
add_material_function_input¶
Additive
Add a FunctionInput node (a new input pin) to a UMaterialFunction asset with the optional props applied, then recompile the function and mark it dirty without saving. Returns node_id, the handle for set_material_function_input_props and remove_material_function_input, plus num_inputs and added. added is the input count re-read: the call fails when it did not rise by one or a sent prop does not read back.
| Parameter | Type | Required | Description |
|---|---|---|---|
function_path |
string | yes | Full path to the material function, e.g. '/Game/MyGame/MF_Example.MF_Example' |
input_name |
string | yes | Name of the new input pin, stored as given: a name another input already uses is not made unique. |
input_type |
string | no | One of the 13 EFunctionInputType values: Scalar|Vector2|Vector3|Vector4|Texture2D|TextureCube|Texture2DArray|VolumeTexture|StaticBool|MaterialAttributes|TextureExternal|Bool|Substrate (optional, default "Scalar") |
description |
string | no | Optional tooltip/description string for the input pin |
preview_value |
object | no | JSON object {"x":0,"y":0,"z":0,"w":0} (FVector4f), any subset; missing components keep their current value. Used for previews, and as the default with use_preview_value_as_default. |
use_preview_value_as_default |
boolean | no | Optional bool; if true, the preview value becomes the input's default |
sort_priority |
integer | no | Optional int controlling the input's display order relative to other inputs |
Returns: { function_path: string, input_name: string, input_type: string, node_id: string, num_inputs: number, added: bool, success: bool, error?: string }
add_material_function_output¶
Additive
Add a FunctionOutput node, the output pin named output_name, to a UMaterialFunction asset loaded from function_path, then recompile the function (loaded materials that use it recompile too) and mark it dirty, without saving and without an undo transaction. Each call adds another node, so it is not idempotent, and output_name is stored as given: a name another output already has is not made unique. The new output starts unwired, placed right of the graph below the existing outputs, and node_id is its handle; added confirms the output count rose by one and the new node carries output_name; false fails the call. A function that does not load is an error. Wire it with connect_pins, edit it with set_material_function_output_props, and its inverse is remove_material_function_output; inputs are add_material_function_input; list pins with get_material_function_info; persist with save_asset.
| Parameter | Type | Required | Description |
|---|---|---|---|
function_path |
string | yes | Full path to the material function, e.g. "/Game/MyGame/MF_Example.MF_Example" |
output_name |
string | yes | Name of the new output pin, stored as given: a name another output already uses is not made unique |
Returns: { function_path: string, output_name: string, node_id: string, num_outputs: number, added: bool, success: bool, error?: string }
compile_material¶
Destructive
Recompile a UMaterial asset through UMaterialEditingLibrary::RecompileMaterial: refreshes its child material instances and the viewports and marks the package dirty, without saving. recompiled is always true and does not report shader errors: verification says not_verifiable, so read compile_errors and stats_valid with get_material_stats. Material functions use recompile_material_function.
| Parameter | Type | Required | Description |
|---|---|---|---|
material_path |
string | yes | UMaterial asset path, e.g. "/Game/Materials/M_Rock"; a material instance or function path fails with Material not found. |
Returns: { material: string, recompiled: bool, verification: object, verification_checks: [object] }
copy_material_instance_dynamic_parameters¶
Destructive
Copy parameter values from a source material or material instance into a transient Material Instance Dynamic (MID), found by object path or name as create_material_instance_dynamic returns it. The MID's current overrides are cleared first, then every non-static parameter the MID exposes takes the source's value where the source has that parameter; static switches are not copied. Takes effect at once, nothing saved, no undo. Refused, with the MID untouched, when the source is the MID itself or has none of its parameters. copied is measured: every copyable parameter read back on the MID with the source's value. For saved Material Instance Constant assets use copy_material_instance_parameters.
| Parameter | Type | Required | Description |
|---|---|---|---|
mid_object_path |
string | yes | Object path of the MID |
source_material_path |
string | yes | Content path to the source material to copy from |
Returns: { mid_object_path, source_material_path, source_material_name, params_in_source, params_copied, params_not_in_source, mismatched_params, copied }
copy_material_instance_parameters¶
Additive
Bulk-copy every scalar, vector and texture OVERRIDE from one material instance to another -- the way to clone a calibration onto a sibling instance instead of re-setting parameters one by one. Copies overrides only, so anything the source inherited untouched is not carried, and STATIC SWITCHES are not copied at all (set those with set_material_instance_parameter). The copied counts are the source overrides the destination stores with the same value after the save, and all_copied false fails the call; diff_material_instances shows what still differs.
| Parameter | Type | Required | Description |
|---|---|---|---|
source_path |
string | yes | Content path of the source UMaterialInstanceConstant. |
destination_path |
string | yes | Content path of the destination UMaterialInstanceConstant. |
Returns: { source_path: string, destination_path: string, scalars_copied: int, vectors_copied: int, textures_copied: int, all_copied: bool }
create_dynamic_material_on_actor¶
Destructive
Give one material slot of a mesh component on an editor-world actor its own Material Instance Dynamic (UPrimitiveComponent::CreateDynamicMaterialInstance), which replaces the slot's material with the MID, in one undo step that marks the level dirty; no asset is created or saved. The actor is matched by object name or label (first match), the component is its first StaticMeshComponent, else its first mesh component. Without parent_material_path the MID wraps the slot's current material, and a slot already holding a MID returns that same MID with created false, changing nothing; with it, the slot is first set to that material. Pass mid_object_path to set_material_instance_dynamic_parameter, or to get_material_parameters as material_instance_path; verified confirms the slot holds the MID. A missing actor, mesh component or material, or an out-of-range element_index, is an error. Unowned MID: create_material_instance_dynamic; saved asset: create_material_instance.
| Parameter | Type | Required | Description |
|---|---|---|---|
actor_name |
string | yes | Name or label of the actor in the editor world; the first actor whose object name or label matches is used |
element_index |
integer | no | Material slot index on the mesh component (default 0); must be below the component's slot count |
parent_material_path |
string | no | Optional source material for the MID (default slot's current material); when given it is assigned to the slot before the MID is made from it |
Returns: { actor_name, actor_label, component_name, element_index, mid_object_path, mid_name, parent_material_path, verified, created, note? }
create_material¶
Additive
Create a new base material asset (UMaterial) -- the graph-owning master whose parameters and static switches every instance of it inherits. Prefer create_material_instance when you only need a re-skin of something that exists: an instance costs no new shader permutations and leaves the original updatable. After creating, build the graph with add_graph_node + connect_pins, then verify with get_material_stats (compile_errors empty and stats_valid true) -- compile_material only acknowledges, it does not report errors, and a landscape material that fails to compile silently falls back to the default material. success is the new material found again at material_path.
| Parameter | Type | Required | Description |
|---|---|---|---|
material_path |
string | yes | Content FOLDER the material is created in (e.g., '/Game/Materials') |
material_name |
string | yes | Name of the material asset to create |
Returns: { material_path: string (object path of the new material, '/Game/Materials/M_X.M_X'), material_name: string, package_path: string, success: bool, error?: string } -- an existing asset of that name is an error, never overwritten
create_material_function¶
Additive Idempotent
Create an empty material function asset named name in package_path -- a plain UMaterialFunction through the editor factory, or with usage MaterialLayer / MaterialLayerBlend a material layer or layer blend function, the way the editor's factories make them -- exposed to the material function library, with the optional description stored as its tooltip, then save it. Idempotent: an existing material function at that path, whatever its class or usage, is returned untouched with already_exists=true, already_existed=true, created=false and saved=false, and nothing is saved (description is ignored then and comes back as the function's own); another asset class there, or an invalid package path, is an error. A failed save (PIE running, read-only file) makes success false with created=true, saved=false and save_error, the function kept in memory. Then add pins with add_material_function_input and add_material_function_output and nodes with add_graph_node; read it back with get_graph_nodes; a variant with overrides: create_material_function_instance; use it in a material: add_material_function_call (a layer or blend: set_material_layer_stack); inverse: delete_asset.
| Parameter | Type | Required | Description |
|---|---|---|---|
package_path |
string | yes | /Game package directory, e.g. '/Game/MyGame'; a trailing slash is ignored |
name |
string | yes | Asset name for the new material function |
description |
string | no | Text stored as the function Description, the tooltip shown wherever the function is used; default empty. Ignored when the function already exists. |
usage |
string | no | Optional "Default" (a plain UMaterialFunction, the default), "MaterialLayer" (a UMaterialFunctionMaterialLayer) or "MaterialLayerBlend" (a UMaterialFunctionMaterialLayerBlend), any case. Any other value is an error |
Returns: { function_path: string, asset_path: string, name: string, package_path: string, class: string, usage: string, description: string, num_inputs: number, num_outputs: number, created: bool, already_existed: bool, saved: bool, save_error?: string, already_exists?: bool }
create_material_function_instance¶
Additive Idempotent
Create a UMaterialFunctionInstance asset named instance_name in package_path through the editor factory, parented to the material function or function instance at parent_function_path, then save it. package_path is any long package path, such as /Game/Materials or a plugin's /MyPlugin/Funcs; a relative folder is read under /Game, a missing folder is made, and an unmounted or malformed path is an error. Idempotent: an instance already at that path is returned unchanged with already_existed=true, created=false and saved=false, its own parent in parent_function_path (the requested one is ignored) and nothing saved; another asset class there is an error. A parent that does not load is an error and nothing, not even the folder, is created; a failed save (PIE running, read-only file) makes success false with saved=false and save_error, the new instance kept in memory. Re-parent later: set_material_function_instance_parent; a new base function: create_material_function.
| Parameter | Type | Required | Description |
|---|---|---|---|
package_path |
string | yes | Target folder as a long package path, e.g. /Game/Materials or /MyPlugin/Funcs; a relative folder is read under /Game |
instance_name |
string | yes | Name for the new UMaterialFunctionInstance asset |
parent_function_path |
string | yes | Asset path of the parent UMaterialFunctionInterface |
Returns: { asset_path: string, instance_name: string, parent_function_path: string, created: bool, already_existed: bool, saved: bool, save_error?: string }
create_material_instance¶
Additive Idempotent
Create a material instance (MIC) from a parent material -- the cheap, non-destructive way to re-skin a vendor or engine material: the parent stays untouched and updatable while only your overrides are stored, and no new shader is compiled -- optionally applying a dict of parameter overrides in the same call. Idempotent (already_exists=true when it is already there; parameter_overrides are then not applied and note says so). The parent may be omitted (a parentless instance) and may be given as a bare material NAME instead of a path; resolve an ambiguous name first. Check applied_overrides_count against what you sent and re-read with get_material_parameters: a name the parent does not expose is simply not applied. Tune it later with set_material_instance_parameter, and remember static switches inherit from the parent and are set separately.
| Parameter | Type | Required | Description |
|---|---|---|---|
instance_name |
string | yes | Name of the material instance to create |
instance_path |
string | no | Content folder for the material instance (e.g., '/Game/Materials'); defaults to /Game/MCP. The asset is created at <instance_path>/<instance_name> |
package_path |
string | no | Alias of instance_path |
name |
string | no | Alias of instance_name |
parent_material_path |
string | no | Optional parent material: a full path ('/Game/Materials/MyMaterial.MyMaterial') or a bare material asset name looked up under /Game; omit it for a parentless instance |
parameter_overrides |
object | no | Optional dict {param_name: scalar_number | {r,g,b[,a]} vector object | static_switch_bool} applied to the new instance before it is saved |
Returns: { instance_path: string, instance_name: string, material_instance_path: string, material_instance_name: string, parent_material?: string, parent_material_path: string, parent_material_name: string, created: bool, already_existed: bool, applied_overrides: [{name, type}], applied_overrides_count: int, success: bool, already_exists?: bool, note?: string, saved: bool, save_error?: string }
create_material_instance_dynamic¶
Additive
Create a Material Instance Dynamic (MID) of a parent material in the transient package: a runtime-only object that is never saved, belongs to no actor and has no undo step. The plugin keeps a reference to every MID it makes this way, so garbage collection does not free it; no tool releases one, so each lives until the editor closes. Set its parameters with set_material_instance_dynamic_parameter, which takes its mid_object_path, or use create_dynamic_material_on_actor to have a mesh component own a MID it renders. A name another MID holds gets a numbered suffix, so keep mid_name and mid_object_path from the reply; each call creates another MID. A parent that cannot be loaded, or a name held by an object of another class, is an error. Read its values with get_material_parameters (material_instance_path = its mid_object_path); a saved, reusable instance asset: create_material_instance. created is the new MID's parent read back as the parent material; false fails the call.
| Parameter | Type | Required | Description |
|---|---|---|---|
parent_material_path |
string | yes | Content path to the parent material (e.g. /Game/MyGame/M_Example.M_Example); a material or a material instance |
name |
string | no | Optional name for the MID (default auto-generated from MID_ and the parent's name) |
Returns: { mid_object_path, mid_name, parent_material_path, parent_material_name, created }
create_material_parameter_collection¶
Additive Idempotent
Create a UMaterialParameterCollection asset at package_path/name and save it to disk. Idempotent: an existing collection there is returned unchanged with created=false, already_exists=true and saved=false, and nothing is saved, while another asset type at that path is an error naming it. A failed save makes success false with saved=false. Returns collection_path, scalar_count, vector_count and saved. Add parameters with add_collection_parameter (param_type scalar or vector); read them with get_collection_info.
| Parameter | Type | Required | Description |
|---|---|---|---|
name |
string | yes | Asset name without a path, e.g. "MPC_Global" |
package_path |
string | no | Content folder for the asset, e.g. "/Game/MaterialCollections" (the default) |
Returns: { name: string, package_path: string, collection_path: string, asset_path: string, collection_class: string, scalar_count: int, vector_count: int, created: bool, already_exists: bool, success: bool, saved: bool, message: string }
create_post_process_material¶
Destructive Idempotent
Create a UMaterial named name in package_path through the editor factory, configured as a post-process material (domain PostProcess, blended after tonemapping), then recompile and save it. Idempotent create or convert: an existing UMaterial at that path has those two settings overwritten, is recompiled and saved, and answers created=false, already_exists=true and a note with its old domain; one that already has them is left as it is (changed=false, saved=false, a note), nothing recompiled or saved. Another asset class there, or an invalid path, is an error. A failed save makes success false with saved=false and save_error, the material kept in memory. Add nodes with add_graph_node and wire them to the output with connect_pins (target_node_id=@output); another domain: set_material_domain.
| Parameter | Type | Required | Description |
|---|---|---|---|
package_path |
string | yes | /Game package directory, e.g. '/Game/MyGame' |
name |
string | yes | Asset name for the new material |
Returns: { material_path: string, name: string, package_path: string, domain: string, blendable_location: number, is_post_process: bool, created: bool, already_exists: bool, changed: bool, saved: bool, save_error?: string, note?: string }
create_subsurface_profile¶
Additive Idempotent
Create a USubsurfaceProfile asset named name in package_path (default /Game/Gameplay; trailing slashes trimmed) with the engine's default settings, then save it; mean_free_path_distance reads one of those settings back. Idempotent: an asset at that path that loads as a subsurface profile is returned as it is, with already_existed=true, created=false and saved=false, and nothing is saved; one of another class is an error, and so is an invalid package path. A failed save (PIE running, read-only file) makes success false with saved=false and save_error, but the new profile stays registered in memory, so a repeat call answers already_existed=true for an asset that is not on disk: persist it with save_asset. Edit its Settings struct with set_properties on the asset path, then save_asset.
| Parameter | Type | Required | Description |
|---|---|---|---|
name |
string | yes | Asset name (e.g. SSP_Example) |
package_path |
string | no | Target /Game package path (optional, default "/Game/Gameplay") |
Returns: { name: string, asset_path: string, asset_class: string, mean_free_path_distance: number, is_subsurface_profile: bool, already_existed: bool, created: bool, saved: bool, save_error?: string }
diff_material_instances¶
Read-only
Diff two Material Instance Constants: what side B overrides differ from side A (parent + scalar/vector/texture/static-switch overrides + material layer stack). Answers "what did this fork change vs its parent (or the original)". Read-only; nothing is saved. Editor-only.
| Parameter | Type | Required | Description |
|---|---|---|---|
material_instance_path_a |
string | yes | Content path to the first (baseline) UMaterialInstanceConstant. |
material_instance_path_b |
string | yes | Content path to the second (fork) UMaterialInstanceConstant. |
Returns: { material_instance_path_a: string, material_instance_path_b: string, parent: {a, b, same}, scalars: {changed: [{name, association?, layer_index?, value_a, value_b}], only_in_a: [{name, value}], only_in_b: [{name, value}], changed_count, only_in_a_count, only_in_b_count}, vectors: {changed: [{name, value_a:{r,g,b,a}, value_b:{r,g,b,a}}], only_in_a, only_in_b, ...counts}, textures: {changed: [{name, value_a, value_b}], only_in_a, only_in_b, ...counts}, static_switches: {changed: [{name, value_a, value_b}], only_in_a, only_in_b, ...counts}, layer_stack: {layer_count_a, layer_count_b, blend_count_a, blend_count_b, layer_diffs: [{index, function_a, function_b}], blend_diffs: [{index, function_a, function_b}]}, total_differences: int, identical: bool }
duplicate_material_expression¶
Additive
Copy one expression node of a UMaterial asset into the same material, optionally renamed, then recompile the material and mark it dirty without saving. The copy keeps the source position and settings (a parameter keeps its name) and its output is unwired. Returns duplicate_node and expression_count. The call fails when the copy is not among the material's expressions.
| Parameter | Type | Required | Description |
|---|---|---|---|
material_path |
string | yes | Full asset path of the UMaterial. |
node_id |
string | yes | Object name of the expression to copy, as listed by get_graph_nodes (nodes[].name). |
new_node_name |
string | no | Object name for the copy; when taken, a unique variant is used (read duplicate_node). Default: a name the engine picks. |
Returns: { material_path: string, source_node: string, duplicate_node: string, duplicate_class: string, expression_count: number, success: bool, error?: string }
duplicate_material_parameter_collection¶
Additive
Copy a Material Parameter Collection asset to package_path/new_name, with every scalar and vector parameter's name, Id and default value, then save the copy; the source is not changed and there is no undo step. Use it to start a variant of an existing collection; for an empty one use create_material_parameter_collection, and for any other asset type duplicate_asset. An asset already at the target path is refused, so a repeat call fails and nothing changes; a source that does not load as a collection, or an invalid target name, is an error too. A failed save makes success false, with saved false, save_error and the copy only in memory. Read the copy with get_collection_info; rename its parameters with rename_collection_parameter.
| Parameter | Type | Required | Description |
|---|---|---|---|
source_path |
string | yes | Collection to copy, as an asset path, e.g. "/Game/MPC/MPC_A", or the object path "/Game/MPC/MPC_A.MPC_A". |
new_name |
string | yes | Asset name of the copy without folder, e.g. "MPC_B"; must be a valid, non-empty asset name. |
package_path |
string | no | Target folder, e.g. "/Game/MPC"; default is the folder of source_path when it is an object path with a dot ("/Game/MPC/MPC_A.MPC_A"), else "/Game/MaterialCollections". |
Returns: { source_path: string, collection_path: string, asset_path: string, name: string, package_path: string, scalar_count: int, vector_count: int, duplicated: bool, saved: bool, save_error?: string }
get_collection_info¶
Read-only
Read the parameters of a Material Parameter Collection asset: scalar_params (name, default, id, index), vector_params (name, id, default object, default_rgba, index), scalar_count, vector_count and total_count. Read-only. Narrow it to one parameter with param_name and/or one kind with param_type: the lists then hold only the matches, found says whether the name matched, and the counts stay the collection's totals. index is the parameter's position in its scalar or vector array. The live per-world values: get_material_parameter_collection_instance_info.
| Parameter | Type | Required | Description |
|---|---|---|---|
collection_path |
string | yes | Full /Game path to the MPC asset |
param_name |
string | no | Optional: list only the parameter with this name, and report found |
param_type |
string | no | Optional "scalar" or "vector": list only that kind. Any other value is an error |
Returns: { collection_path: string, collection_name: string, collection_class: string, scalar_params: [{name, default, id, index}], vector_params: [{name, id, default, default_rgba, index}], scalar_count: int, vector_count: int, total_count: int, found?: bool (with param_name) }
get_material_function_info¶
Read-only
Describe a material function asset -- a plain function, a material layer, a layer blend or a function instance -- without changing it: its class and usage ("Default", "MaterialLayer" or "MaterialLayerBlend"), is_layer / is_blend, the input and output pin counts it exposes (num_inputs, num_outputs; an instance reports its parent's) and num_expressions, plus, for a UMaterialFunction, its FunctionInput and FunctionOutput nodes: node_id, name, type, description, sort priority and preview value for inputs; name, description and sort priority for outputs (a function instance has no nodes of its own, so its lists are empty). For the whole node graph use get_graph_nodes.
| Parameter | Type | Required | Description |
|---|---|---|---|
material_function_path |
string | yes | Asset path of the material function, layer, layer blend or function instance, e.g. "/Game/Materials/MF_Blend". |
layer_path |
string | no | Alias of material_function_path |
Returns: { material_function_path: string, asset_path: string, class: string, usage: string, is_layer: bool, is_blend: bool, num_inputs: number, num_outputs: number, num_expressions: number, input_count: number, output_count: number, inputs: [{ node_id: string, input_name: string, input_type: string, description: string, sort_priority: number, use_preview_value: bool, preview_value: {x,y,z,w} }], outputs: [{ node_id: string, output_name: string, description: string, sort_priority: number }] }
get_material_instance_info¶
Read-only
One-call overview of a material instance (constant, or any other UMaterialInstance): parent material path, name and class, COUNTS of scalar/vector/texture overrides, base property overrides, static switches and static component masks, and the base property overrides themselves -- blend mode, two-sided, shading model and opacity mask clip value, each with its own bOverride_ flag. The flag matters as much as the value: an override that is false means the parent's setting wins whatever value is stored, and a material that looks wrong despite correct parameters is often a blend-mode override. A triage read for parameters -- counts, not values, so it can say "there are 14 static switches here" but never which ones are on: for parameter values use get_material_parameters (parameter_type all includes the static switches). set_material_instance_parent and set_properties write what it reports.
| Parameter | Type | Required | Description |
|---|---|---|---|
material_instance_path |
string | yes | Content path to the material instance (UMaterialInstanceConstant, or any UMaterialInstance). |
Returns: { material_instance_path: string, material_instance_class: string, parent_material_path: string, parent_material_name: string, parent_material_class: string, scalar_param_count: int, vector_param_count: int, texture_param_count: int, base_override_count: int, static_switch_count: int, static_component_mask_count: int, override_blend_mode: bool, blend_mode: string, override_two_sided: bool, two_sided: bool, override_shading_model: bool, shading_model: string, override_opacity_mask_clip_value: bool, opacity_mask_clip_value: float, asset_registry_path: string }
get_material_instance_parameter_overridden¶
Read-only
Is this parameter set on the INSTANCE, or just inherited from the parent? Returns the override flag for one named parameter -- the discriminator that a plain value read cannot give you, since an inherited value and a locally-set identical value read the same. Use it to confirm a write actually landed on the child (and, in a read-only vendor material, to prove you edited your instance and not the library asset). Editor-only.
| Parameter | Type | Required | Description |
|---|---|---|---|
material_instance_path |
string | yes | Content path to the UMaterialInstanceConstant. |
parameter_name |
string | yes | Name of the parameter to query. |
association |
string | no | Optional EMaterialParameterAssociation: "Global" (default), "Layer", or "Blend". |
Returns: { material_instance_path: string, parameter_name: string, association: string, overridden: bool }
get_material_layer_stack¶
Read-only
Read a material's layer stack: the layer functions and blend functions it uses, in order, with has_layers telling you whether the material is layered at all. Check this before any set_material_instance_parameter call -- on a non-layered material the layer indices mean nothing, and here is where you learn which index is which surface.
| Parameter | Type | Required | Description |
|---|---|---|---|
material_instance_path |
string | yes | Content path to the material |
Returns: { material_instance_path: string, layers: [{name, function_path}], blends: [{name, function_path}], layer_count: int, blend_count: int, has_layers: bool }
get_material_parameter_collection_instance_info¶
Read-only
Read the live per-world values of a Material Parameter Collection (its transient instance on one world) without changing any value: current_value per scalar and current_rgba per vector, each with readback_ok (false when the instance lacks that parameter, the value then being the asset default) and overridden (the instance holds its own value for it, even one equal to the default), plus parent_collection_path and is_valid. The world is the editor world by default, or the Play-in-Editor world world_label selects; the world fields and pie_instance (-1 outside PIE) say which one answered. Use it to check set_material_parameter_collection_instance_value or reset_material_parameter_collection_instance; for the saved defaults use get_collection_info. The engine lookup creates the instance at the defaults when the world has none, so instance_exists is true in practice; scalar_override_count and vector_override_count count the parameters the instance overrides (0 right after reset_material_parameter_collection_instance). A collection that does not load, or a world_label no live world matches, is an error.
| Parameter | Type | Required | Description |
|---|---|---|---|
collection_path |
string | yes | Asset path of the collection, e.g. "/Game/MPC/MPC_Global", as get_collection_info takes it. |
world_label |
string | no | Which world: empty or "editor" for the editor world (the default), even while Play-in-Editor runs; "pie" (alias "game") for the running PIE world, "server" or "client" for that PIE world, "pie:N" for PIE instance N. any other value names a live world by its object name (the editor world is checked first, so a map name selects it) or by its package name (UEDPIE_N_ and the map name for a PIE world), and a value no world has fails and lists the worlds present |
Returns: { collection_path: string, world_name: string, world_package: string, world_type: string, net_mode: string, pie_instance: int, instance_exists: bool, is_valid: bool, parent_collection_path: string, scalar_override_count: int, vector_override_count: int, scalars: [{ name, current_value, readback_ok, overridden }], vectors: [{ name, current_rgba, readback_ok, overridden }] }
get_material_parameters¶
Read-only
What can I tune on this material without recompiling it: EVERY parameter the material or its parent exposes, each with its EFFECTIVE value (the instance's own override, else what it inherits), whether this instance overrides it, its layer association and layer index. This is the contract -- untouched parameters are listed too, with the value they inherit. Works on a base material, a material instance, or a live Material Instance Dynamic found by object path or name. By default it lists scalar, vector and texture parameters; parameter_type static_switch, static_component_mask or all adds the STATIC parameters, the switches and channel masks that decide whether whole shader branches run at all. Narrow it to one parameter with parameter_name (found tells a misspelled name from a value; when exactly one entry matches its value and overridden are also copied to the top level), to one layer slot with association + layer_index, and to the instance's own overrides with overridden_only. orphaned_overrides lists overrides an instance still stores for parameters its parent no longer exposes: they are kept on the asset and apply to nothing.
| Parameter | Type | Required | Description |
|---|---|---|---|
material_instance_path |
string | yes | Content path to the material (a base material or an instance), or the object path or name of a live Material Instance Dynamic (as create_material_instance_dynamic returns it) |
parameter_type |
string | no | Optional kind filter: "scalar", "vector", "texture", "static_switch", "static_component_mask", or "all" for every kind. Omitted: scalar, vector and texture. Any other value is an error |
param_type |
string | no | Alias of parameter_type |
parameter_name |
string | no | Optional: list only the parameter(s) with this name (case-insensitive) and report found |
param_name |
string | no | Alias of parameter_name |
association |
string | no | Optional association filter: "Global", "Layer" or "Blend". Any other value is an error |
layer_index |
integer | no | Optional layer index filter (a Layer/Blend parameter's slot; Global parameters have -1) |
overridden_only |
boolean | no | Optional bool (default false): list only the parameters this instance overrides itself |
Returns: { material_instance_path: string, object_path: string, parent_material: string (parent's object path, "None" for a base material), parent_material_name: string, mid_name?: string (when the target is a Material Instance Dynamic), parameters: [{name, type, association, layer_index, value?, overridden}], parameter_count: int, orphaned_overrides: [{name, type, association, layer_index, value}], orphaned_override_count: int, found?: bool (with parameter_name), value?: number|{r,g,b,a}|string|bool, overridden?: bool }
get_material_physical_material¶
Read-only
Which physical material a material is linked to -- what decides footstep sounds, impact effects, friction and surface type when something hits this surface. Reads the RAW field with no engine-default fallback, so an empty path means "nothing authored here" and the engine default applies at runtime; that distinction is exactly what you want when auditing why a surface sounds wrong. set_material_physical_material writes it.
| Parameter | Type | Required | Description |
|---|---|---|---|
material_path |
string | yes | Full path to the material (e.g., '/Game/Materials/MyMaterial.MyMaterial') |
Returns: { material_path: string, physical_material_path: string, success: bool }
get_material_referencers¶
Read-only
What would I break if I changed this material: every asset that references it, bucketed by kind (static mesh, skeletal mesh, blueprint, level, other) with counts, plus the material's own blend mode and two-sided / masked / translucent / opaque flags. The impact check before editing or deleting a shared material. Note it takes a material NAME, not a path, so an ambiguous name can resolve to the wrong asset -- confirm with resolve_asset_by_name first. Nothing to do with get_material_usage_flag, which is about permitted geometry types.
| Parameter | Type | Required | Description |
|---|---|---|---|
material_name |
string | yes | Name of the material asset |
Returns: { material_name: string, material_class: string, material_category: string, material_tooltip: string, material_display_name: string, usage: [{package_name, asset_name, asset_class, asset_path, usage_type, usage_category, asset_category, asset_tooltip, asset_display_name}], usage_count: int, static_mesh_usage_count: int, skeletal_mesh_usage_count: int, blueprint_usage_count: int, level_usage_count: int, other_usage_count: int, material_has_referencers: bool, material_is_two_sided: bool, material_is_masked: bool, material_is_translucent: bool, material_is_opaque: bool, blend_mode: string }
get_material_stats¶
Read-only
Read PER-ASSET shader complexity for a material or material instance (instruction counts, sampler/texture-sample counts) -- the numbers the Material Editor's Stats panel shows, unlike get_shader_info (project-wide/global). Read-only: does not Modify()/dirty the asset. Render-adjacent: forces synchronous shader compilation on the FIRST call for a given material (UMaterialEditingLibrary::GetStatistics blocks on FMaterialResource::FinishCompilation); subsequent calls are fast once the shader map is cached. Works for both UMaterial and UMaterialInstance (UMaterialInterface's GetMaterialResource is virtual/overridden on both).
| Parameter | Type | Required | Description |
|---|---|---|---|
material_path |
string | yes | Full path to the material or material instance (e.g., '/Game/Materials/MyMaterial.MyMaterial') |
Returns: { material_path, material_class, num_vertex_shader_instructions, num_pixel_shader_instructions, num_samplers, num_vertex_texture_samples, num_pixel_texture_samples, num_virtual_texture_samples, num_uv_scalars, num_interpolator_scalars, compile_errors: string[], stats_valid: bool }
get_material_usage_flag¶
Read-only
Is this material allowed to be used on that kind of geometry? Reads one EMaterialUsage flag (SkeletalMesh, InstancedStaticMeshes, Niagara, SplineMesh, ...) on a base material. The check to make when a material renders fine on a static mesh and comes out as the default grey checker on a skeletal mesh or an instanced mesh -- a missing usage flag is exactly that symptom. Accepts the name with or without the MATUSAGE_ prefix; set_material_usage_flag enables it (and forces a shader recompile).
| Parameter | Type | Required | Description |
|---|---|---|---|
material_path |
string | yes | Full path to the material (e.g., '/Game/Materials/MyMaterial.MyMaterial') |
usage |
string | yes | Usage flag name, with or without the MATUSAGE_ prefix (e.g., 'SkeletalMesh' or 'MATUSAGE_SkeletalMesh') |
Returns: { material_path: string, usage: string, enabled: bool, success: bool }
is_substrate_enabled¶
Read-only
Report whether Substrate (Strata) materials are enabled in this editor. Always works. Returns substrate_enabled (from Substrate::IsSubstrateEnabled), the r.Substrate cvar value, and a note when disabled. Enabling Substrate requires editing config and restarting the editor.
No parameters.
Returns: { substrate_enabled: bool, r_substrate_cvar: int, note?: string, detected: bool }
recompile_material_function¶
Destructive
Recompile a material function, layer or function instance (UpdateMaterialFunction): loaded materials using it recompile and dependent function instances are marked dirty but not saved, then the function itself is saved; success requires that save. recompiled is always true, not a shader-error report.
| Parameter | Type | Required | Description |
|---|---|---|---|
material_function_path |
string | yes | Asset path of the UMaterialFunctionInterface (function, layer or function instance), e.g. "/Game/Materials/MF_Blend". |
Returns: { material_function_path: string, function_class: string, recompiled: bool, saved: bool }
regenerate_collection_parameter_id¶
Destructive
Assign a new random FGuid Id to one parameter of a Material Parameter Collection asset and save it; returns new_id. It searches only the array param_type selects (default scalar) and errors when the name is not there.
| Parameter | Type | Required | Description |
|---|---|---|---|
collection_path |
string | yes | Full /Game path to the MPC asset |
param_name |
string | yes | Name of the parameter to regenerate the id for |
param_type |
string | no | Which array to search: "scalar" or "vector", any case; omitted or anything else means scalar |
Returns: { collection_path: string, param_name: string, param_type: string, new_id: string, regenerated: bool, saved: bool }
remove_collection_parameter¶
Destructive
Remove one parameter from a Material Parameter Collection asset by name and save it, or with all=true clear every parameter of a kind (or both kinds) at once. Errors when param_name is not in the array param_type selects. Reports the scalar and vector counts before and after.
| Parameter | Type | Required | Description |
|---|---|---|---|
collection_path |
string | yes | Full /Game path to the MPC asset |
param_name |
string | no | Name of the parameter to remove. Required unless all is true, and must be omitted with all=true |
param_type |
string | no | Which array: "scalar" or "vector" (default scalar); with all=true also "all" (the default then) for both arrays. Other values: scalar without all, an error with all=true |
all |
boolean | no | Optional bool (default false): clear every parameter of param_type instead of one |
Returns: { collection_path: string, param_name?: string, param_type: string, removed?: bool, cleared?: bool (all=true), scalar_count_before: int, vector_count_before: int, scalar_count: int, vector_count: int, saved: bool }
remove_material_function_input¶
Destructive Idempotent
Delete a UMaterialExpressionFunctionInput node from a material function (inverse of add_material_function_input). Located by node_id via the function's own expression list. Idempotent: an already-absent node_id returns { deleted:false, already_absent:true } as success, not an error. deleted is the re-read (one input fewer and node_id gone); false fails the call.
| Parameter | Type | Required | Description |
|---|---|---|---|
function_path |
string | yes | Full path to the material function, e.g. '/Game/MyGame/MF_Example.MF_Example' |
node_id |
string | yes | The input node id (UMaterialExpression name) from add_material_function_input |
Returns: { function_path: string, node_id: string, deleted: bool, already_absent: bool, num_inputs: number, num_outputs: number, success: bool, error?: string }
remove_material_function_output¶
Destructive Idempotent
Delete a UMaterialExpressionFunctionOutput node from a material function (inverse of add_material_function_output). Located by node_id via the function's own expression list. Idempotent: an already-absent node_id returns { deleted:false, already_absent:true } as success, not an error. deleted is the re-read (one output fewer and node_id gone); false fails the call.
| Parameter | Type | Required | Description |
|---|---|---|---|
function_path |
string | yes | Full path to the material function, e.g. '/Game/MyGame/MF_Example.MF_Example' |
node_id |
string | yes | The output node id (UMaterialExpression name) from add_material_function_output |
Returns: { function_path: string, node_id: string, deleted: bool, already_absent: bool, num_inputs: number, num_outputs: number, success: bool, error?: string }
rename_collection_parameter¶
Destructive
Rename one scalar or vector parameter of a Material Parameter Collection asset, keeping its Id so the materials that read it keep resolving it, in one undo step, then save the asset. Use it rather than remove_collection_parameter plus add_collection_parameter, which gives the parameter a new Id that those materials do not know; to give it a new Id on purpose use regenerate_collection_parameter_id. A new_name already used in the same array, the parameter's own name included (names compare case-insensitively), is refused, so repeating a rename fails; a param_name that is not in the array param_type selects is an error; nothing changes in either case. A collection that does not load is an error; a failed save makes success false, with saved false, save_error and the rename only in memory. List the names with get_collection_info.
| Parameter | Type | Required | Description |
|---|---|---|---|
collection_path |
string | yes | Asset path of the collection, e.g. "/Game/MPC/MPC_Global" or the object path "/Game/MPC/MPC_Global.MPC_Global". |
param_name |
string | yes | Current name of the parameter, as get_collection_info lists it (scalar_params[].name or vector_params[].name); case-insensitive. |
new_name |
string | yes | New parameter name, e.g. "WindStrength"; must not be used by another parameter of the same kind (compared case-insensitively). |
param_type |
string | no | Which array to search: "scalar" or "vector", any case; omitted or anything else means scalar |
Returns: { collection_path: string, param_name: string, new_name: string, param_type: string, renamed: bool, saved: bool }
reset_material_parameter_collection_instance¶
Destructive Idempotent
Reset the Material Parameter Collection Instance (MPCI: the transient per-world values of a collection asset) of one collection on a world to the collection's default values by dropping all its scalar and vector overrides. The world is the editor world by default, or the Play-in-Editor world world_label selects; world_package and world_type say which one was reached. Runtime only: nothing is saved, no undo. A world with no instance for the collection gets a fresh one at the defaults (created=true, already_existed=false), so this is also how to give a world its instance; is_valid says whether the instance is bound to a valid collection. scalars_reset_to_default and vectors_reset_to_default count parameters now reading their default. For a Material Instance Constant asset use set_material_instance_parameter_override with all=true and override=false. cleared is true only when every parameter reads its default; otherwise the call fails.
| Parameter | Type | Required | Description |
|---|---|---|---|
collection_path |
string | yes | Full /Game path of the parent MPC |
world_label |
string | no | Which world: empty or "editor" for the editor world (the default), even while Play-in-Editor runs; "pie" (alias "game") for the running PIE world, "server" or "client" for that PIE world, "pie:N" for PIE instance N. any other value names a live world by its object name (the editor world is checked first, so a map name selects it) or by its package name (UEDPIE_N_ and the map name for a PIE world), and a value no world has fails and lists the worlds present |
Returns: { collection_path: string, world_name: string, world_package: string, world_type: string, net_mode: string, pie_instance: int, scalar_count: int, vector_count: int, scalars_reset_to_default: int, vectors_reset_to_default: int, cleared: bool, is_valid: bool, already_existed: bool, created: bool }
set_collection_parameter_default¶
Destructive Idempotent
Change the default value stored in a Material Parameter Collection asset for one existing parameter, in one undo step, then save the asset; every material reading the collection sees the new default. A scalar parameter takes scalar_value, a vector parameter takes vector [r, g, b, a]; the value is read back from the asset into the reply. This edits the asset; to override the value only in a running world use set_material_parameter_collection_instance_value. Add a parameter first with add_collection_parameter; list names, kinds and current defaults with get_collection_info; rename with rename_collection_parameter. Idempotent: the same value again rewrites it and saves. A collection that does not load, a name that is neither a scalar nor a vector parameter, or a missing value for the parameter's kind is an error and nothing changes; a failed save (for example while PIE runs) makes success false with the change only in memory.
| Parameter | Type | Required | Description |
|---|---|---|---|
collection_path |
string | yes | Asset path of the Material Parameter Collection, e.g. "/Game/Materials/MPC_Weather", as create_material_parameter_collection returns it. |
param_name |
string | yes | Exact name of an existing parameter, e.g. "WindStrength", as get_collection_info lists it. |
scalar_value |
number | no | New float default for a scalar parameter, e.g. 0.75; required when the parameter is scalar, ignored for a vector one. |
vector |
array | no | New linear color default for a vector parameter, as a JSON array [r, g, b, a] of floats, e.g. [1, 0.5, 0, 1]; alpha is 1 when only three values are given. Required when the parameter is a vector. |
Returns: { collection_path: string, param_name: string, param_type: string, default_set: bool, saved: bool, default_value: number, scalar_value: number, default: object, default_rgba: [number] }
set_material_domain¶
Destructive Idempotent
Set the material domain (EMaterialDomain) of a UMaterial asset, then recompile it and mark its package dirty, without saving and without an undo transaction. domain is matched without case and also accepts spellings such as post_process, decal or light function; an unknown domain is an error before the material loads, and a material instance or a path that does not load is an error (Material not found). Setting the domain it already has still recompiles. previous_domain and domain are read back, and domain_set confirms the change took, and false fails the call. Persist with save_asset; a new post-process material is create_post_process_material; a recompile alone is compile_material.
| Parameter | Type | Required | Description |
|---|---|---|---|
material_path |
string | yes | Full path to the material, e.g. '/Game/MyGame/M_Example.M_Example'; a UMaterial, not a material instance |
domain |
string | yes | One of 'Surface', 'PostProcess', 'UI', 'DeferredDecal', 'LightFunction', 'Volume', matched without case; post_process, userinterface, decal, deferred_decal and light_function (or the same words with spaces) work too |
Returns: { material: string, material_path: string, previous_domain: string, requested_domain: string, domain: string, domain_set: bool, success: bool, error?: string }
set_material_function_input_props¶
Destructive Idempotent
Edit an existing FunctionInput node of a UMaterialFunction asset, found by node_id: only the fields you pass are written (name, type, description, preview value, default flag, sort priority), then the function is recompiled and marked dirty without saving. Read it back with get_material_function_info. applied is the re-read: false, with the props that differ named in error, fails the call.
| Parameter | Type | Required | Description |
|---|---|---|---|
function_path |
string | yes | Full path to the material function, e.g. '/Game/MyGame/MF_Example.MF_Example' |
node_id |
string | yes | The input node id (UMaterialExpression name) from add_material_function_input |
input_name |
string | no | New pin name, stored as given: it is not made unique (the engine ValidateName only acts on nodes owned by a material). |
input_type |
string | no | Optional EFunctionInputType (the 13 values; same parser as add_material_function_input) |
description |
string | no | New tooltip text of the input pin. |
preview_value |
object | no | JSON object {"x":0,"y":0,"z":0,"w":0} (FVector4f), any subset; missing components keep their current value. |
use_preview_value_as_default |
boolean | no | Bool: true makes the preview value the default of the input when its pin is left unconnected. |
sort_priority |
integer | no | Integer that orders this input pin relative to the other inputs of the function. |
Returns: { function_path: string, node_id: string, input_name: string, input_type: string, applied: bool, success: bool, error?: string }
set_material_function_instance_parent¶
Destructive Idempotent
Re-parent a UMaterialFunctionInstance asset loaded from instance_path to the material function or function instance at parent_function_path, in one undo step, then save it. old_parent and new_parent are read back from the asset ("(none)" when empty), and applied is true once the parent is set. Success requires the save: a failed save (PIE running, read-only file) makes success false with saved=false and save_error, the new parent kept in memory. A path containing // is refused before anything loads, and an instance or parent that does not load is an error; nothing changes then. The parent it already has is a success with applied=false, saved=false and a note, nothing changed or saved. Create an instance with create_material_function_instance; recompile it with recompile_material_function.
| Parameter | Type | Required | Description |
|---|---|---|---|
instance_path |
string | yes | Asset path of the UMaterialFunctionInstance to re-parent |
parent_function_path |
string | yes | Asset path of the new parent UMaterialFunctionInterface |
Returns: { instance_path: string, old_parent: string, new_parent: string, applied: bool, saved: bool, save_error?: string, note?: string }
set_material_function_output_props¶
Destructive Idempotent
Set properties on an existing UMaterialExpressionFunctionOutput (located by node_id). Partial update (idempotent). ValidateName is re-run when output_name changes. applied is the re-read: false, with the props that differ named in error, fails the call.
| Parameter | Type | Required | Description |
|---|---|---|---|
function_path |
string | yes | Full path to the material function, e.g. '/Game/MyGame/MF_Example.MF_Example' |
node_id |
string | yes | The output node id (UMaterialExpression name) from add_material_function_output |
output_name |
string | no | Optional new pin name (re-validated for uniqueness) |
description |
string | no | Optional tooltip/description string |
sort_priority |
integer | no | Optional int display-order |
Returns: { function_path: string, node_id: string, output_name: string, applied: bool, success: bool, error?: string }
set_material_instance_dynamic_parameter¶
Destructive Idempotent
Set a scalar, vector (color) or texture parameter override on a transient Material Instance Dynamic (MID), found by object path or name as create_material_instance_dynamic or create_dynamic_material_on_actor return it; it takes effect at once and is never saved. param_type picks the kind, or it is inferred from value: a number is a scalar, an {r,g,b,a} object a vector, a string a texture path. param_name must be a global parameter of that kind of the MID's material (as get_material_parameters lists it for the MID); any other name is refused and nothing is written. set is the read-back of the new value.
| Parameter | Type | Required | Description |
|---|---|---|---|
mid_object_path |
string | yes | Object path of the MID (from create_material_instance_dynamic) |
param_name |
string | yes | Name of a parameter of the MID's material, of the kind written |
mid_path |
string | no | Alias of mid_object_path |
parameter_name |
string | no | Alias of param_name |
param_type |
string | no | Optional "scalar", "vector" or "texture"; default inferred from value (number -> scalar, object -> vector, string -> texture). Any other value, or one that does not match the value's shape, is an error |
value |
any | no | New value: a float for a scalar, a color object {r, g, b, a} for a vector (a missing component is 0, a missing a is 1), a texture content path for a texture. Required unless texture_path is given |
texture_path |
string | no | Alias of value for a texture parameter (a texture content path) |
Returns: { mid_object_path, param_name, param_type, old_value, new_value (numbers for a scalar, {r, g, b, a} for a vector), old_texture_path?, new_texture_path?, requested_texture_path? (texture), set }
set_material_instance_parameter¶
Destructive Idempotent
Set a parameter override on a Material Instance Constant asset and re-read it: a scalar, vector or texture global parameter (set comes from the re-read, as the engine setter always returns false, plus value_after and overridden_after; the package is marked dirty, not saved), a static switch or static component mask (its static permutation rebuilt and the instance saved), or, with layer_index, a scalar, vector or texture parameter of one layer of a layered instance. Malformed vectors are rejected. set_material_instance_parameter_override toggles or clears overrides; set_material_instance_dynamic_parameter writes a transient MID.
| Parameter | Type | Required | Description |
|---|---|---|---|
instance_path |
string | yes | Asset path of the UMaterialInstanceConstant, e.g. "/Game/Materials/MI_Rock". |
param_name |
string | yes | Parameter name as defined in the parent material, e.g. "BaseTint"; only global parameters are reached, not layer parameters. |
value |
any | no | Value. Scalar: a number (JSON number or numeric string). Vector: '(R=..,G=..,B=..,A=..)', '[r,g,b,a]', '[r,g,b]', 'r,g,b,a', 'r,g,b', or a real JSON array of 3-4 numbers; anything else is REJECTED (never written as black). Texture: an asset path. Static switch: a bool or 'true'/'false'. |
association |
string | no | Optional, static switch or component mask: GlobalParameter (default), LayerParameter or BlendParameter |
layer_index |
integer | no | Optional: the zero-based layer of a layered instance; with a scalar, vector or texture param_type it writes that layer's parameter |
param_type |
string | no | "scalar" | "vector" | "texture" | "static_switch" | "static_component_mask" (a value [r, g, b, a] of bools) (optional, inferred from the value: a JSON array => vector, a JSON bool => static_switch, a JSON number => scalar, a string starting with '/' => texture, with '(' or '[' => vector, else scalar. A bool passed AS A STRING still reads as scalar, so pass param_type explicitly in that case) |
Returns: { instance: string, instance_path: string, param_name: string, param_type: string, value_format?: string, set: bool, value_after: number|object|string|bool|null, overridden_after: bool, value_requested: number|object|string|bool, requested: {...} }
set_material_instance_parameter_override¶
Destructive Idempotent
Toggle the per-parameter override flag on a Material Instance Constant (any of the 11 parameter types, including static switch), or with all=true clear EVERY parameter override at once. bOverride=true keeps/enables the local override; bOverride=false REVERTS the parameter to the parent material's value (removes the override). Runs UpdateMaterialInstance and persists. Returns honestly: success=false when the parameter is not found on the instance. all=true with override=false resets every scalar, vector and texture value to what the parent gives (ClearParameterValuesEditorOnly) and persists, reporting cleared. Editor-only.
| Parameter | Type | Required | Description |
|---|---|---|---|
material_instance_path |
string | yes | Content path to the UMaterialInstanceConstant. |
override |
boolean | yes | Bool: true = keep local override; false = revert to parent (remove the value). Must be false with all=true. |
parameter_name |
string | no | Name of the parameter whose override flag to toggle. Required unless all is true. |
association |
string | no | Optional EMaterialParameterAssociation: "Global" (default), "Layer", or "Blend". |
all |
boolean | no | Optional bool (default false): with override=false, clear every parameter override of the instance instead of one; parameter_name is then not used and must be omitted. |
Returns: { material_instance_path: string, parameter_name?: string, association?: string, requested_override: bool, applied?: bool, overridden?: bool, cleared?: bool (all=true), saved: bool }
set_material_instance_parent¶
Destructive Idempotent
Re-parent a material instance onto a different base material -- how you swap an instance from a vendor master to your own without recreating it and re-pointing every referencer. Overrides whose parameter names do not exist on the new parent become orphaned and silently stop applying, so re-read with get_material_parameters afterwards and expect to re-check the static switches, whose defaults come from the new parent. parent_set is the instance's parent re-read; false (a parent that would make a cycle is refused) fails the call.
| Parameter | Type | Required | Description |
|---|---|---|---|
material_instance_path |
string | yes | Content path to the UMaterialInstanceConstant. |
new_parent_path |
string | yes | Content path of the new parent UMaterialInterface. |
Returns: { material_instance_path: string, old_parent: string, new_parent: string, changed: bool, parent_set: bool }
set_material_layer_stack¶
Destructive Idempotent
Define which material-layer and blend functions a layered material instance stacks, in order -- how you compose a surface (base + dirt + snow) out of reusable layer functions instead of editing the base material graph. Order is significant and layers are addressed downstream by index (set_material_instance_parameter), so re-stacking renumbers existing per-layer values. success is the instance's stack re-read against the requested layers and blends; get_material_layer_stack shows it.
| Parameter | Type | Required | Description |
|---|---|---|---|
material_instance_path |
string | yes | Content path to the MIC |
layers |
array | no | Optional list of {function_path} dicts naming layer material functions. |
blends |
array | no | Optional list of {function_path} dicts naming blend material functions. |
Returns: { material_instance_path: string, layer_count: int, blend_count: int, success: bool }
set_material_parameter_collection_instance_value¶
Destructive Idempotent
Override one scalar or vector (color) parameter on the Material Parameter Collection Instance (MPCI: the transient per-world values) of a collection asset on one world, creating the instance when needed, and push the value to the renderer. A scalar takes value; a vector takes rgba or r/g/b/a (r/g/b/a override the matching rgba entries, and channels given by neither are 0, alpha 1, not the current value) -- the color form is used when any of those is given or when parameter_name is a vector of the collection. The world is the editor world by default, or the Play-in-Editor world world_label selects; world_package and world_type say which one was reached. Runtime only: the asset is untouched, nothing is saved, no undo, and the override is lost when the instance is rebuilt. A missing value or color, a collection that does not load, an unmatched world, or a parameter_name that is not a parameter of that kind in the collection is an error; readback_value / readback_rgba is what the instance holds afterwards, and one that differs from what was written makes success false with readback_ok=false. Saved default: set_collection_parameter_default; drop every override: reset_material_parameter_collection_instance; read values: get_material_parameter_collection_instance_info.
| Parameter | Type | Required | Description |
|---|---|---|---|
collection_path |
string | yes | Full /Game path of the parent MPC |
parameter_name |
string | yes | Name of the scalar or vector parameter to override |
value |
number | no | New float value for a scalar parameter. Required unless a color (rgba or r/g/b/a) is given for a vector parameter |
rgba |
array | no | Optional [r, g, b, a] color for a vector parameter |
r |
number | no | Optional red channel for a vector parameter, alternative to rgba |
g |
number | no | Optional green channel |
b |
number | no | Optional blue channel |
a |
number | no | Optional alpha channel |
world_label |
string | no | Which world: empty or "editor" for the editor world (the default), even while Play-in-Editor runs; "pie" (alias "game") for the running PIE world, "server" or "client" for that PIE world, "pie:N" for PIE instance N. any other value names a live world by its object name (the editor world is checked first, so a map name selects it) or by its package name (UEDPIE_N_ and the map name for a PIE world), and a value no world has fails and lists the worlds present |
Returns: { collection_path: string, parameter_name: string, param_type: string ("scalar" or "vector"), value?: number, readback_value?: number (scalar), value_rgba?: [number], readback_rgba?: [number] (vector), readback_ok: bool, world_name: string, world_package: string, world_type: string, net_mode: string, pie_instance: int }
set_material_physical_material¶
Destructive Idempotent
Link (or clear) the UPhysicalMaterial on a UMaterial asset and persist it to disk. Idempotent: re-setting the same phys-mat returns already_set=true. An empty/omitted physical_material_path CLEARS the link (sets it to null). success needs the link to read back and the save to reach disk: a failed save fails the call (saved=false, save_error).
| Parameter | Type | Required | Description |
|---|---|---|---|
material_path |
string | yes | Full path to the material (e.g., '/Game/Materials/MyMaterial.MyMaterial') |
physical_material_path |
string | no | Path to the UPhysicalMaterial asset to link, or "" / omitted to clear the link |
Returns: { material_path: string, physical_material_path: string, already_set: bool, saved: bool, save_error?: string, success: bool, error?: string }
set_material_usage_flag¶
Destructive Idempotent
Turn one usage flag (EMaterialUsage: SkeletalMesh, InstancedStaticMeshes, NiagaraSprites, SplineMesh...) on or off on a base UMaterial asset, which recompiles its shaders for that usage, then save the material. Use it when get_material_usage_flag shows the flag off for geometry that renders the material as the default checker; it works on base materials only, so set it on the parent of a material instance. Idempotent: when the flag already has that value the engine setter does nothing (already_set=true), though the material is still saved. Not an undo step. An unknown usage name or a path that does not load as a UMaterial is an error and nothing changes. A failed save (a read-only file, say) makes success false, with saved=false and save_error, and leaves the flag set in memory only.
| Parameter | Type | Required | Description |
|---|---|---|---|
material_path |
string | yes | Object or package path of the base material, e.g. '/Game/Materials/M_Base.M_Base' or '/Game/Materials/M_Base'. |
usage |
string | yes | EMaterialUsage name with or without the MATUSAGE_ prefix, e.g. 'SkeletalMesh', 'InstancedStaticMeshes' or 'MATUSAGE_Nanite'; any other name is an error. |
enabled |
boolean | no | true (default) turns the flag on, false turns it off. |
Returns: { material_path: string, usage: string, enabled: bool (read back from the material), already_set: bool, saved: bool, save_error?: string }
set_substrate_slab_scalar¶
Destructive
Drives one input pin of the Substrate Slab BSDF node of a material with a constant: adds a NEW Constant expression holding value to the material graph and wires it into the named pin of the material's first Slab node, replacing whatever fed that pin, then saves the material. Each call adds another Constant node, even for the same pin and value; a constant that fed the pin before stays in the graph, unwired. One undo step removes the new constant and restores what fed the pin. A failed save (a read-only file, PIE running) makes success false with saved=false and save_error, the change kept in memory. Works whether Substrate is enabled or not (substrate_enabled reports it). The material needs a Slab node (add_graph_node with node_type=/Script/Engine.MaterialExpressionSubstrateSlabBSDF); connect_pins to @output, pin FrontMaterial, wires it to the output. A pin name the Slab node does not have is an error that names its pins, and nothing is added. To change a constant already wired, use set_properties on its object_path (from get_graph_nodes); remove stray nodes with remove_graph_node.
| Parameter | Type | Required | Description |
|---|---|---|---|
material_path |
string | yes | Package or object path of the UMaterial holding the slab node (e.g. "/Game/Materials/M_Substrate"). |
pin_name |
string | yes | Slab input pin to drive, by its input name as get_graph_nodes lists it (input_name), without case: e.g. "Roughness", "Anisotropy", "F0" or "Diffuse Albedo" (a color pin receives the scalar on all channels). |
value |
number | yes | Scalar the Constant node holds (e.g. 0.35 for Roughness); not range-checked. |
Returns: { material_path: string, slab_node_id: string, constant_node_id: string, pin_name: string, value: number, connected: bool, saved: bool, save_error?: string, substrate_enabled: bool, r_substrate_cvar: int, note?: string } -- connected is read back from the slab pin
swap_material_layer_parameters¶
Destructive
Exchange two layer slots on a layered material instance -- reorder which surface sits above which without rebuilding the whole stack with set_material_layer_stack. Every per-layer parameter moves with the slot, so any index you recorded earlier now points at the other layer; re-read get_material_layer_stack afterwards. success is false when the two slots' scalar, vector and texture overrides did not trade places.
| Parameter | Type | Required | Description |
|---|---|---|---|
material_instance_path |
string | yes | Content path to the MIC |
original_index |
integer | yes | The original layer parameter index |
new_index |
integer | yes | The new layer parameter index to swap with |
Returns: { material_instance_path: string, original_index: int, new_index: int, success: bool }