bevy-inspector-egui icon indicating copy to clipboard operation
bevy-inspector-egui copied to clipboard

Support immutable components

Open StrikeForceZero opened this issue 7 months ago • 3 comments

Instead of showing a component doesn't exist on an entity, it would be cool to show a read-only view of its properties (or maybe update the component through insertion)

Current behavior: Image

Desired behavior: Image

StrikeForceZero avatar Apr 28 '25 18:04 StrikeForceZero

Read-only support added via https://github.com/jakobhellermann/bevy-inspector-egui/pull/261

Would we want support of editing the immutable components via insertion? Would probably only work for components that derive copy or clone. If it even is possible - would probably want to put it behind a feature flag or make it obvious when "editing" immutable in UI.

StrikeForceZero avatar May 24 '25 13:05 StrikeForceZero

Hmm. I wouldn't implement it just because it's possible, but if you have a use case then I would be open to having that implemented.

I'm assuming usually when something is immutable, that's because locally editing it might result in an inconsistent state.

If we implement this, I'd agree that it should be visually obvious to see what you're doing but I wouldn't put it behind a feature flag.

jakobhellermann avatar May 24 '25 13:05 jakobhellermann

I have implemented a simple "Clicked Mesh Inspector" for allowing me to inspect a clicked Entity, via the Component Inspector. The problem I'm running into (since Bevy 0.16) is:

  1. The click can happen on the child mesh and I need to view and sometimes edit the Parent.
  2. Since Immutable Components, the ChildOf does not allow it, unlike earlier when Parent would reference the Parent Entity.

A few suggestions:

  1. Can we allow the Entity in Components refer to the actual entity and editable like before, irrespective of immutability?
  2. Immutable Components should still show the data, but it can be read-only.

nilaysavant avatar May 30 '25 13:05 nilaysavant