Entities instantiated from templates are missing their anim layer masks

I have one template which has an anim component with a single layer and a mask. If I instantiate a new entity from this template like so:

let template = this.app.assets.find('Player');
let player = template.resource.instantiate();
this.app.root.addChild(player);

The mask will not be present on the newly instantiated entity. All the animations & state graph etc work fine, just not the mask. I can place the same entity in the scene using the editor and the mask works fine.

chrome-capture (3)
In this example, I’m using a mask that disables the bones on the left side of the character’s body. The character on the left was placed manually using the editor and the one on the right was instantiated from the template. As we can see, the mask applies to the left one but not the right. It’s unclear if this is intended behaviour or a bug with anim layer masks when combined with the use of templates.

I can still assign masks using the AnimComponentLayer assignMask() method which works fine.

Here is an example project.

Ah right, sounds like a bug, but not fully sure.

@Elliott @yaustar may know more.

1 Like

Created a ticket for this: https://github.com/playcanvas/engine/issues/4031

1 Like