playcanvas / playcanvas/engine

Implement control over order of execution of component update and postUpdate functions

Open
#1,857 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Currently the order of execution of update and postUpdate functions cannot be easily / at all controlled by the user, and they are likely called in order components are created / enabled. This is causing issues when you need your components to be updated in specific order - for example character first, then it's attachment, and camera that follows the character last.
Currently we have access to update / postUpdate allowing 2 layer ordering, but ideally these can be ordered by individual Script name.
Also, ideally there would be public API to this allowing order to be set from code.

At the moment we have "Scripts loading order", which sorts order in which scripts are initialized. Perhaps this should be used to control execution order as well.

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

No files, tests, or entry points are named. Start by locating the component update and postUpdate dispatch logic and the existing Scripts loading order implementation; determine how execution order is currently established. Done should include a defined public API for controlling per-script update order and coverage for the character, attachment, and camera ordering described in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
game-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.