bevyengine / bevyengine/bevy

Resources that are created via the normal Component-path API place IsResource on the Data Entity

Closed
#25,763 1 comment 0 reactions 0 assignees View on GitHub
A-ECS C-Bug S-Needs-Design
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

## Bevy version and features

Main

## What you did

Was thinking through an expansion to the design of Resources as Components.
Discord: https://discord.com/channels/691052431525675048/749335865876021248/1548528942967947375

## What went wrong

`IsResource` is an Required Component for Resources, which means it gets added/inserted onto whatever Entity the Resource is, which for the expected Resource-path API is sound/correct, but when using the normal Component-path API then `IsResource` will end up on the Data Entity rather then the Component/Resource Entity. (The Component/Resource Entity also ceases to exist as well)

## Additional information

`world.spawn(MyResource)` - Data Entity: MyResource, IsResource
vs
`world.init_resource::()` - Component/Resource Entity: MyResource, IsResource

I'm honestly not sure if you would consider this a bug, because technically Components as Entities hasn't happened yet, so the Resource Entity is and isn't one. I would assume though, since the Components as Entities path is almost guaranteed at this point that this is indeed a bug, but maybe cant be fixed till Components as Entities proper.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the difference between world.spawn(MyResource) and world.init_resource::() and trace how each API handles the Data Entity and Component/Resource Entity. Read the resource and required-component paths involved, then define and test the expected IsResource placement once Components as Entities support is considered complete.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.