Hi everyone,
I am currently developing a tool to sync materials between projects using the Editor API.
I’m trying to copy the data from one material asset to another, using code similar to this:
const allAssets = editor.call(‘assets:list’);
const targetAsset = allAssets.find(asset => asset.get(‘name’) === “ABC”);
const getAsset = allAssets.find(asset => asset.get(‘name’) === “XYZ”);
const getData = getAsset.get(‘data’);
targetAsset.set(‘data’, getData);
When I run this command, the operation fails with the following validation error:
Error: invalid:exception: Max operator failed for path: .reflectivity, expected: <= 1, actual: 5
The error message implies that the value for .reflectivity must be less than or equal to 1.
However, the key issue is that in the PlayCanvas Editor UI, I can manually set the reflectivity value as high as 8 for the same material without any errors.
Could someone please clarify why the Editor API is enforcing a maximum value of 1, while the Editor UI allows a value of 8? Is this an intended limitation of the API, or am I missing a step in how I should be setting the asset data?
Thank you for your help.