bevyengine / bevyengine/bevy

Update/change fields of a reflected/dynamic type

Open
#14,850 1 comment 0 reactions 0 assignees View on GitHub
A-Reflection C-Feature D-Complex
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

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

I can only get a `&mut dyn Reflect` from `field_mut` from `DynamicTupleStruct` (and similar) which I can modify, but e.g. changing the field from being a `DynamicStruct` to a `DynamicEnum` isn't possible.

## What solution would you like?

Add the option to replace fields

## What alternative(s) have you considered?

I currently have no idea of how to do that externally..

## Additional context

Might be easier when unifying fields (https://github.com/bevyengine/bevy/issues/14847#issuecomment-2301674088) ?

Contributor guide

Open the contributing guide

Research direction

Start by reading the reflection APIs around DynamicTupleStruct and field_mut, then review the discussion linked from issue #14847 about unifying fields. Determine how a field could be replaced with another reflected dynamic type, and consider the public API and tests needed to demonstrate that replacement works.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.