Skip to content

Support material property assignment #318

@msanatan

Description

@msanatan

Extended ApplyMaterialProperties to loop through all properties in the provided JObject and set them directly on the material if they match a known property (e.g., _Color, _MainTex, etc.). Now supports direct assignment of color, float, and texture properties using simple JSON structures, such as: { "_Color": [0, 1, 0, 1] } for albedo color
{ "_Glossiness": 0.5 } for smoothness
{ "_MainTex": "Assets/Textures/MyTex.png" } for textures Retained backward compatibility with the previous structured property format (color, float, texture objects). This change enables more flexible and user-friendly material creation and modification via automation and external tools. Fixes issues where material color and other properties could not be set from automation.

Based on changes in this PR that can't easily be merged: https://github.com/CoplayDev/unity-mcp/pull/120/files#diff-46221d69c246fb655ff8aeb7622d55ce82d276f6f2907220194d82918d0396f1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions