playcanvas / playcanvas/engine

Add API to assign material to a sprite

Open
#4,303 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area: sprites enhancement
Dominant language
JavaScript
Stars
16.8k
Forks
2k
Avg merge
4h 32m
Merged PRs (30d)
222

Description

Forum: https://forum.playcanvas.com/t/animated-sprite-with-custom-shader-material/26060/

Currently it isn't possible to assign a custom material to an animated sprite as in updateFrame, it has a check where if it's not using the default sprite material, it changes it back to using it making overriding it impossible without monkey patching.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/framework/components/sprite/component.js at updateFrame, which currently restores the default sprite material when a custom material is assigned. Define the API needed to assign a material to an animated sprite, then verify that frame updates preserve the custom material instead of replacing it.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
game-dev
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.