Skip to content

Somehow prevent confusion caused by Assets being removed due to not having RenderAssetUsages::MAIN_WORLD #19737

@laundmo

Description

@laundmo

What problem does this solve or what need does it fill?

One of the common causes of hard-to-diagnose issues i see people having is having the wrong RenderAssetUsages set. Most of the time the issue is silent, making it hard to figure out why things aren't working.

Examples:

What solution would you like?

#19207 is a good step, but it only covers one of many places where this issue could occur.

  • only affects picking
  • only affects Mesh

I think one solution could look like this:
Don't fully remove the handle from Assets in extract_render_asset. Either leave a marker in its place, or store the handle separately. This would likely require a method Assets::remove_with_reason or similar. Then, in the various methods for getting the asset data, log out a warning if one of those handles has been requested. Probably should be warn_once! or maybe a smarter thing based on track_caller where its logged once for each caller.

What alternative(s) have you considered?

And abundance of documentation and materials could also somewhat alleviate this, but thats far from ideal.
Another option could be to make Assets::get return a Result instead of a Option, allowing it to report a reason why it failed, though that assumes people don't just let-else the Err into oblivion.

Additional context

none so far

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-AssetsLoad files from disk to use for things like images, models, and soundsA-PickingPointing at and selecting objects of all sortsA-RenderingDrawing game state to the screenC-FeatureA new feature, making something new possibleS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!X-ContentiousThere are nontrivial implications that should be thought through

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions