# unreal_input_materials The `unreal_input_materials` tool covers Enhanced Input setup and material instance management. It exposes 6 operations for creating input actions, building mapping contexts, adding key bindings, and creating and configuring material instances. ## Operations at a Glance | Operation | Hint | Description | |-----------|------|-------------| | `create_input_action` | — | Create an Enhanced Input action asset | | `create_mapping_context` | — | Create an Input Mapping Context asset | | `add_mapping` | — | Add an action mapping to a context with key bindings | | `create_material_instance` | — | Create a Material Instance from a parent material | | `set_material_parameters` | idempotent | Set scalar, vector, and texture parameters on an instance | | `get_material_info` | readOnly | Get all parameters and their current values from a material | ## create_input_action Creates a new Enhanced Input `UInputAction` asset. Input Actions define what player actions exist (Jump, Attack, Move) independently of which keys trigger them. ### Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `path` | string | yes | Destination content path including asset name | | `value_type` | string | yes | Action value type: `bool`, `axis1d`, `axis2d`, `axis3d` | | `triggers` | array | no | Default trigger types to add: `pressed`, `released`, `held`, `tap`, `double_tap` | | `modifiers` | array | no | Default modifier types: `negate`, `swizzle`, `dead_zone`, `scalar` | ```json { "operation": "create_input_action", "params": { "path": "/Game/Input/Actions/IA_Jump", "value_type": "bool", "triggers": ["pressed"] } } ``` ```json { "operation": "create_input_action", "params": { "path": "/Game/Input/Actions/IA_Move", "value_type": "axis2d" } } ``` ```json { "operation": "create_input_action", "params": { "path": "/Game/Input/Actions/IA_Look", "value_type": "axis2d", "modifiers": ["dead_zone"] } } ``` ### Response ```json { "path": "/Game/Input/Actions/IA_Jump", "value_type": "bool", "created": true } ``` > **Note:** Input Actions define the semantic intent of player input — not the physical key. Physical key bindings are added separately via `add_mapping` on a Mapping Context. ## create_mapping_context Creates a new `UInputMappingContext` asset. Mapping Contexts group a set of action-to-key bindings that can be activated and deactivated together at runtime. ### Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `path` | string | yes | Destination content path including asset name | | `priority` | integer | no | Default priority when added to the player. Higher values take precedence. Default: 0. | ```json { "operation": "create_mapping_context", "params": { "path": "/Game/Input/IMC_Default", "priority": 0 } } ``` ```json { "operation": "create_mapping_context", "params": { "path": "/Game/Input/IMC_UI", "priority": 10 } } ``` ### Response ```json { "path": "/Game/Input/IMC_Default", "priority": 0, "created": true } ``` ## add_mapping Adds an action-to-key binding to an existing Mapping Context. Each call adds one mapping entry. ### Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `context` | string | yes | Full content path of the Mapping Context | | `action` | string | yes | Full content path of the Input Action | | `key` | string | yes | Key identifier string (see key names below) | | `modifiers` | array | no | Modifiers to apply to this mapping: `negate`, `swizzle`, `dead_zone`, `scalar` | | `triggers` | array | no | Triggers for this specific mapping: `pressed`, `released`, `held` | ### Common Key Names | Key String | Physical Key | |------------|-------------| | `SpaceBar` | Space | | `LeftMouseButton` | Left click | | `RightMouseButton` | Right click | | `W`, `A`, `S`, `D` | WASD | | `Gamepad_FaceButton_Bottom` | Xbox A / PS Cross | | `Gamepad_FaceButton_Right` | Xbox B / PS Circle | | `Gamepad_LeftX` | Left stick horizontal axis | | `Gamepad_LeftY` | Left stick vertical axis | | `Gamepad_RightX` | Right stick horizontal axis | | `Gamepad_RightY` | Right stick vertical axis | | `Gamepad_LeftTriggerAxis` | Left trigger | | `Gamepad_RightTriggerAxis` | Right trigger | | `Gamepad_LeftShoulder` | LB / L1 | | `Gamepad_RightShoulder` | RB / R1 | ```json { "operation": "add_mapping", "params": { "context": "/Game/Input/IMC_Default", "action": "/Game/Input/Actions/IA_Jump", "key": "SpaceBar" } } ``` ```json { "operation": "add_mapping", "params": { "context": "/Game/Input/IMC_Default", "action": "/Game/Input/Actions/IA_Jump", "key": "Gamepad_FaceButton_Bottom" } } ``` ```json { "operation": "add_mapping", "params": { "context": "/Game/Input/IMC_Default", "action": "/Game/Input/Actions/IA_Move", "key": "Gamepad_LeftY", "modifiers": ["dead_zone"] } } ``` > **Tip:** Call `add_mapping` once per key binding. To add both keyboard and gamepad bindings for the same action, call it twice with different `key` values — both mappings live in the same context. ## create_material_instance Creates a new `UMaterialInstance` asset derived from a parent material. Material instances let you vary parameters (colors, textures, scalars) without creating a new material shader. ### Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `path` | string | yes | Destination content path including asset name | | `parent` | string | yes | Full content path of the parent material | ```json { "operation": "create_material_instance", "params": { "path": "/Game/Materials/MI_Rock_Mossy", "parent": "/Game/Materials/M_Rock_Base" } } ``` ```json { "operation": "create_material_instance", "params": { "path": "/Game/Characters/Enemies/MI_Goblin_Green", "parent": "/Game/Characters/Enemies/M_Goblin_Base" } } ``` ### Response ```json { "path": "/Game/Materials/MI_Rock_Mossy", "parent": "/Game/Materials/M_Rock_Base", "created": true } ``` ## set_material_parameters Sets scalar, vector, and texture parameters on a material instance. Only overrides the parameters you specify — all others inherit from the parent. ### Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `path` | string | yes | Full content path of the material instance | | `scalars` | object | no | Map of scalar parameter names to float values | | `vectors` | object | no | Map of vector parameter names to `{ r, g, b, a }` objects | | `textures` | object | no | Map of texture parameter names to full content paths | ```json { "operation": "set_material_parameters", "params": { "path": "/Game/Materials/MI_Rock_Mossy", "scalars": { "Roughness": 0.8, "Metallic": 0.0, "MossAmount": 0.6 }, "vectors": { "BaseColor": { "r": 0.18, "g": 0.28, "b": 0.14, "a": 1.0 } }, "textures": { "DiffuseTexture": "/Game/Textures/T_Rock_Mossy_D", "NormalMap": "/Game/Textures/T_Rock_Mossy_N" } } } ``` ```json { "operation": "set_material_parameters", "params": { "path": "/Game/Characters/Enemies/MI_Goblin_Green", "scalars": { "EmissiveStrength": 0.0 }, "vectors": { "SkinTint": { "r": 0.22, "g": 0.45, "b": 0.12, "a": 1.0 } } } } ``` > **Note:** `set_material_parameters` is tagged `idempotentHint`. Applying the same parameters twice produces the same result. Safe to parallelize across different material instance paths. ## get_material_info Returns all parameters defined in a material or material instance, along with their current values and whether they are overriding the parent. ### Parameters | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `path` | string | yes | Full content path of the material or material instance | ```json { "operation": "get_material_info", "params": { "path": "/Game/Materials/MI_Rock_Mossy" } } ``` ### Response ```json { "name": "MI_Rock_Mossy", "parent": "/Game/Materials/M_Rock_Base", "scalars": [ { "name": "Roughness", "value": 0.8, "overriding": true }, { "name": "Metallic", "value": 0.0, "overriding": true }, { "name": "MossAmount", "value": 0.6, "overriding": true }, { "name": "Opacity", "value": 1.0, "overriding": false } ], "vectors": [ { "name": "BaseColor", "value": { "r": 0.18, "g": 0.28, "b": 0.14, "a": 1.0 }, "overriding": true } ], "textures": [ { "name": "DiffuseTexture", "value": "/Game/Textures/T_Rock_Mossy_D", "overriding": true }, { "name": "NormalMap", "value": "/Game/Textures/T_Rock_Mossy_N", "overriding": true }, { "name": "RoughnessMap", "value": "/Game/Textures/T_Rock_Rough", "overriding": false } ] } ``` > **Note:** `get_material_info` is tagged `readOnlyHint` — safe to parallelize with other read-only calls. ## Complete Workflow: Enhanced Input Setup ```javascript // 1. Create input actions (can parallelize — independent assets) await parallel([ create_input_action({ path: "/Game/Input/Actions/IA_Jump", value_type: "bool", triggers: ["pressed"] }), create_input_action({ path: "/Game/Input/Actions/IA_Move", value_type: "axis2d" }), create_input_action({ path: "/Game/Input/Actions/IA_Look", value_type: "axis2d", modifiers: ["dead_zone"] }), create_input_action({ path: "/Game/Input/Actions/IA_Attack", value_type: "bool", triggers: ["pressed"] }), ]) // 2. Create the mapping context await create_mapping_context({ path: "/Game/Input/IMC_Default", priority: 0 }) // 3. Add keyboard mappings await add_mapping({ context: "/Game/Input/IMC_Default", action: "/Game/Input/Actions/IA_Jump", key: "SpaceBar" }) await add_mapping({ context: "/Game/Input/IMC_Default", action: "/Game/Input/Actions/IA_Attack", key: "LeftMouseButton" }) // Move uses 4 keys (WASD) — add each separately await add_mapping({ context: "/Game/Input/IMC_Default", action: "/Game/Input/Actions/IA_Move", key: "W", modifiers: [] }) await add_mapping({ context: "/Game/Input/IMC_Default", action: "/Game/Input/Actions/IA_Move", key: "S", modifiers: ["negate"] }) await add_mapping({ context: "/Game/Input/IMC_Default", action: "/Game/Input/Actions/IA_Move", key: "D", modifiers: ["swizzle"] }) await add_mapping({ context: "/Game/Input/IMC_Default", action: "/Game/Input/Actions/IA_Move", key: "A", modifiers: ["swizzle", "negate"] }) // 4. Add gamepad mappings await add_mapping({ context: "/Game/Input/IMC_Default", action: "/Game/Input/Actions/IA_Jump", key: "Gamepad_FaceButton_Bottom" }) await add_mapping({ context: "/Game/Input/IMC_Default", action: "/Game/Input/Actions/IA_Attack", key: "Gamepad_RightTriggerAxis" }) await add_mapping({ context: "/Game/Input/IMC_Default", action: "/Game/Input/Actions/IA_Move", key: "Gamepad_LeftY" }) await add_mapping({ context: "/Game/Input/IMC_Default", action: "/Game/Input/Actions/IA_Move", key: "Gamepad_LeftX", modifiers: ["swizzle"] }) await add_mapping({ context: "/Game/Input/IMC_Default", action: "/Game/Input/Actions/IA_Look", key: "Gamepad_RightX" }) await add_mapping({ context: "/Game/Input/IMC_Default", action: "/Game/Input/Actions/IA_Look", key: "Gamepad_RightY", modifiers: ["negate"] }) ``` ## Complete Workflow: Material Variant Set ```javascript // 1. Get the parent material's parameter list const info = await get_material_info({ path: "/Game/Materials/M_Rock_Base" }) // 2. Create multiple instance variants (parallelize — different paths) await parallel([ create_material_instance({ path: "/Game/Materials/MI_Rock_Mossy", parent: "/Game/Materials/M_Rock_Base" }), create_material_instance({ path: "/Game/Materials/MI_Rock_Dry", parent: "/Game/Materials/M_Rock_Base" }), create_material_instance({ path: "/Game/Materials/MI_Rock_Snow", parent: "/Game/Materials/M_Rock_Base" }), ]) // 3. Set parameters on each variant (parallelize — different paths) await parallel([ set_material_parameters({ path: "/Game/Materials/MI_Rock_Mossy", scalars: { Roughness: 0.8, MossAmount: 0.7 }, vectors: { BaseColor: { r: 0.18, g: 0.28, b: 0.14, a: 1.0 } }, textures: { DiffuseTexture: "/Game/Textures/T_Rock_Mossy_D" } }), set_material_parameters({ path: "/Game/Materials/MI_Rock_Dry", scalars: { Roughness: 0.95, MossAmount: 0.0 }, vectors: { BaseColor: { r: 0.42, g: 0.38, b: 0.30, a: 1.0 } }, textures: { DiffuseTexture: "/Game/Textures/T_Rock_Dry_D" } }), set_material_parameters({ path: "/Game/Materials/MI_Rock_Snow", scalars: { Roughness: 0.6, MossAmount: 0.0, SnowAmount: 0.9 }, vectors: { BaseColor: { r: 0.9, g: 0.92, b: 0.95, a: 1.0 } }, textures: { DiffuseTexture: "/Game/Textures/T_Rock_Snow_D" } }), ]) ```