[SOLVED] Merging projects

Can we merge two projects together in Playcanvas?
And is there a way to take assets from another project and transfer them to another?

Thanks in advance

Unfortunately, no.

Unfortunately, no.

That said, there is work being done to load external asset bundle which can help mitigate some of the problems.

When we export a material, we get a JSON file. And when we reupload it in another project, it stays a JSON file.

Is there a way by script or another way, to revert that JSON file to a material. so that we can modify it and work with it in the Editor? (so revert it to a normal asset).

There is a way through code that you can load the assets from an external source as shown here Load 3D models at run time from a PlayCanvas application

I’ve never tried from a JSON asset inside the PlayCanvas editor but it is possible for individual assets. Mappings to materials won’t work though from what I know.

Here’s an example using the raw JSON: How to create/load asset from Json variable (not from file or url)?

Not that I’m aware. There may be a way to do it via the undocumented Editor API. @Leonidas Anything you have found that could help here?

Yes, you can use the method that the Editor uses when duplicating a material:

  1. Open up your PlayCanvas editor
  2. Fire the JS console.
  3. Copy paste the following code replacing the JSON in the data property with your material JSON.
// create a simple red material asset
// this method will work only with material assets
editor.call('assets:create',{
    type: 'material',
    name: 'Material Name',
    tags: null,
    source: false,
    data: JSON.parse('{"diffuse":[0.0,0.5,1]}'),
    preload: true
});

Note: as @yaustar noted all that is undocumented API, prone to change at any time.

2 Likes

I knew you would have something up your sleeve :stuck_out_tongue:

1 Like

That method would only be for materials? or for models and other assets as well?

And thank you for the very helpful replies! you guys are great :slight_smile:

Would be only for materials, and only for material properties.

Textures won’t be mapped automatically, you will have to do that sadly.

Ok, thanks a lot! this helps