playcanvas / playcanvas/engine

AssetRegistry.getByUrl() returns wrong asset type for same URL (texture vs cubemap)

Open
#8,489 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Hi team,
I encountered an issue with AssetRegistry.getByUrl() when working with cubemap assets:
A PNG file URL is used for both a texture asset and a cubemap asset in the registry.
getByUrl(url) only returns the last added asset (e.g., texture instead of cubemap), even though the cubemap asset with the same URL exists.
Since _urlToAsset is a Map that overwrites entries with the same URL, getByUrl() can’t distinguish assets by type, which makes it impossible to reliably retrieve cubemap assets via URL (a common use case for skyboxes).
Is there a recommended way to get an asset by URL + type (instead of just URL) to avoid this conflict? Or could getByUrl() be enhanced to support type filtering?
Thanks!

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 at AssetRegistry.getByUrl() and inspect how the _urlToAsset map is populated when the same PNG URL is used by texture and cubemap assets. Reproduce the collision, then determine the intended type-filtering behavior; done means URL lookup can reliably select the requested asset type without overwriting alternatives.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.