bevyengine / bevyengine/bevy

`Option<SystemId>` doesn't support `Reflect` while `Option<Entity>` does

Open
#14,496 2 comments 0 reactions 0 assignees View on GitHub
A-ECS A-Reflection C-Usability S-Needs-Design
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

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

Currently, I can't have an `Option` be reflected in a component, because it doesn't implement `Reflect`:
![image](https://github.com/user-attachments/assets/1167c78b-30dd-4b1a-b65e-7e51c7dd05da)

However, since it's just a wrapped `Entity`, I don't see why it can't do this and `Entity` can.
![image](https://github.com/user-attachments/assets/fb4226d9-a2fe-4c33-9d81-a67c10dedd37)

## What solution would you like?

I would like `SystemId` to receive the same treatment as `Entity` - I think the solution is to derive `TypePath` for `SystemId`.

## What alternative(s) have you considered?

Using `#[reflect(ignore)]` on the `SystemId` - this by all means works, but since (I think) it's good practice to have `#[derive(Component, InspectorOptions, Default, Reflect)]` on every component (that's the way "Bevy Snippets" in vscode does it), beginners (like me) who don't know about `#[reflect(ignore)]` can be caught off guard trying to find alternatives (such as storing the system ids in a resource).

Not using `Reflect` - Same as before, I think using Reflect is the convention, and making that a concious decision here might be confusing to beginners.

## Additional Context
(Note that I only learned about Reflect vs FromReflect at the middle of writing, I only put the `Option` since by default `#[derive(Reflect)]` requires `Default`)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.