Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AnimComponentLayer.getAnimationAsset always returns {"asset": null} on template instances created at runtime #6860

Closed
Mintytorus opened this issue Jul 29, 2024 · 0 comments · Fixed by #6863
Labels
area: animation Animation related issue bug

Comments

@Mintytorus
Copy link
Contributor

Description

When instantiating an entity with an Anim component from a template at runtime, AnimComponentLayer.getAnimationAsset never returns a valid animation asset - it always returns an object of the form {"asset": null}. I have filed a separate issue due to this differing from the documentation (which suggests this should return a pc.Asset instance).

Example project:
https://playcanvas.com/project/1240526 (published build)

Steps to Reproduce

  1. Create an entity with an Anim component and populate with assets (a render component, an anim graph with a default animation state, an animation for that state)
  2. Create a template from that entity
  3. Instantiate the template at runtime (i.e. call templateAsset.resource.instantiate(), don't place it in the editor)
  4. Try and get the animation for the default layer by calling AnimComponentLayer.getAnimationAsset

Expected result: Some kind of usable asset (either a pc.Asset or at least an asset id)
Observed result: A Javascript object {asset: null}

Note that for an entity instantiated in the editor (either from the same template or just manually) will return {asset: [ASSET ID NUMBER]} instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: animation Animation related issue bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants