bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
36.24k stars 3.57k forks source link

Observer entities should have names #16384

Open msvbg opened 1 day ago

msvbg commented 1 day ago

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

Observers are spawned as entities. When using a tool like the egui inspector, observer entities are listed under the generic "Entity" name which makes it difficult to understand what they are at a glance

What solution would you like?

Observers should spawn with a Name component which indicates that they are observers.

alice-i-cecile commented 1 day ago

This is partly a bug with bevy-inspector-egui, in that it should special-case Observer entities like it does for other classes of objects. But yeah, we should use the system name ideally.

mgi388 commented 1 day ago

This should be easy to fix in inspector egui. See my recent commit fixing lights associations. https://github.com/jakobhellermann/bevy-inspector-egui/commit/8b684b3608aa321c01b3eb730fefc8307e9a30c6

If someone doesn’t get to it first I’ll try and do a PR over there, separately to this ticket.

BenjaminBrienen commented 1 day ago

Does adding a Name component to every Observer create significant overhead for the sake of a a feature which could be implemented instead by the editor GUI? In other words, can the editor just see what the system name is and use that for Observers? (Special-cased)

msvbg commented 1 day ago

Does adding a Name component to every Observer create significant overhead for the sake of a a feature which could be implemented instead by the editor GUI? In other words, can the editor just see what the system name is and use that for Observers? (Special-cased)

I sincerely doubt it! Observers are not spawned often and there should not be that many of them in a game. Personally I think it's good practice for every entity to have a name, and strive to enforce this in my projects, but this may not be standard in the community. Though I'm fine with any solution.

alice-i-cecile commented 1 day ago

I think we should aim to use Name more aggressively. Long-term, I'd like to move more of our name-like identifiers (like system names) out into the proper Name component.

BenjaminBrienen commented 21 hours ago

In that case, maybe bevy_cli could recommend that with a lint?

alice-i-cecile commented 21 hours ago

Yeah, I would say that's a good style level lint.

mockersf commented 20 hours ago

Putting names on everything means allocating strings for everything. They are nice to debug, but will have a cost