Skip to content

Improve engine API ergonomics for generated PlayCanvas apps #8958

Description

@kpal81xd

Summary

Generated PlayCanvas apps repeatedly trip over public APIs that look like plain mutable data, but actually have engine ownership, lifecycle, readiness, hierarchy, or setter/helper side effects.

This issue tracks engine/API-layout fixes only. Do not solve this in the app template.

Current Status

Area PR Status Notes
Readonly typings/JSDoc for live engine-owned getters #8959 Merged First pass for arrays, maps, transform values, physics/UI values, material state, and related setters.
Entity render traversal and bounds helpers #8960 Draft Adds Entity#forEachRenderMeshInstance(cb) and Entity#getAabb(result?).

Workstreams

Priority Theme Scope Status
P0 Render/model mesh ownership meshInstances readonly getter types, engine-owned docs, explicit replacement path, debug errors for current/stale/destroyed instances. Partly covered by #8959; replacement/debug work remains.
P0 Entity render helpers Subtree mesh traversal and subtree render bounds for common GLB edits. Draft in #8960.
P0 Setter-only object values Transform getters, script order, and other values where component-wise mutation bypasses engine updates. First typings/JSDoc pass merged in #8959; more docs may be needed.
P0 Asset/container readiness Failed-load semantics, loadFromUrlAndFilename retry errors, and container render-resource readiness. Todo.
P0 Mesh lifecycle clarity Mesh#clear dynamic flags and mesh format changes after MeshInstance construction. Todo.
P1 Collections and hierarchy children, component layers, layer mesh lists, current-entity component lookup, tag search behavior. Partly covered by #8959; helper/docs work remains.
P1 Live component values Physics vectors, UI/render vectors/colors/rects, material/blend state, particle graphs, sound slots, anim layers/masks. Partly covered by #8959; helper/docs work remains.
P1 Loading and cloning semantics Container/GLB APIs, generated sub-resource lifetime, clone/shared-resource rules. Todo.
P1 Input ergonomics Nullable input devices and common keyboard code strings. Todo.
P2 Docs/debug polish Mouse target requirement, lifecycle event naming, modern script docs, render pass setup, batch/template dirty/lazy semantics. Todo.

Activity

  1. self-assigned this
    on Jun 24, 2026
  2. LeXXik commented on Jun 24, 2026

    @LeXXik
    Contributor

    Users find PlayCanvas API confusing and agents often hallucinate on it. Do I understand the problem this PR is addressing correctly? Can I ask the basis that was used to shape the problem?

  3. kpal81xd commented on Jun 24, 2026

    @kpal81xd
    ContributorAuthor

    Users find PlayCanvas API confusing and agents often hallucinate on it. Do I understand the problem this PR is addressing correctly? Can I ask the basis that was used to shape the problem?

    Yea the idea it to tighten up the API and make it clearer and intuitive for both developers and agents. This issue was formulated from repeated testing with agent harness sessions to find out where the agents struggled / failed to understand and use the engine from the API.

  4. kpal81xd commented on Jun 25, 2026

    @kpal81xd
    ContributorAuthor

    Closing this tracker; follow-up work is now managed outside GitHub issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions