Share Materials between projects

Hi, this seems quite a simple and useful task in our production line but I wasn’t able to find the right solution so far.

Every time we start a project we import all fbx assets and create the materials on the PlayCanvas editor. Given the same material is often used on multiple projects, is there a way to avoid recreating it every time and save the parameters somehow? Can I download it and then export it on another project? Can I save it on a repo and download it live?

I’ve read “What’s the best way to copy assets between projects now?” but I probably missed something in the answer.

Thanks! Loved PlayCanvas so far!

Giulio

1 Like

It’s not currently possible to copy assets between projects. We do have mechanisms in place that will allow something like this in the future but I have no ETA for you yet.

What you could do is write a little script that will set up your materials automatically and run it in the browser’s console while you’re in the Editor. Here are some methods that could help:

var material = editor.call('assets:get', id) // returns an asset by id
material.set('data.diffuse', [1, 1, 0]) // set diffuse color to yellow
material.set('data.diffuseMap', 3522) // set diffuse map to asset with id 3522

To see all the data that you can set for a material you could do

console.log(material.get('data'))

You can see all methods you can call from the editor if you inspect editor._hooks in the console.

Hope this helps

1 Like

Do we have this feature now?

Seconded, could really use something like this! Asset copying between projects would be great

Is this still something impossible to do?

A 3D artist prepared some scenes in Project A that we need to integrate into Project B, and so far I could not find any easy solution to this other than manually downloading every single .fbx file, editing every single material (because these can’t be downloaded) and recreating the scene myself.

2 Likes