bevyengine / bevyengine/bevy

Duration is reflected as Opaque instead of Struct

Open
#16,908 1 comment 0 reactions 0 assignees View on GitHub
A-Reflection C-Usability D-Complex D-Domain-Expert S-Needs-Design
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

## Bevy version

0.15.0

## What you did

I was trying to use Blenvy to serialize Duration types, but they were just empty strings instead of the `secs: u64, nanos: u64` that I expected.

Turns out that in bevy_reflect, there's this little snippet in [the reflect std impls](https://github.com/bevyengine/bevy/blob/65835f535493a14d4fabe3c1569de61be2e884b1/crates/bevy_reflect/src/impls/std.rs#L119) (`impl_reflect_opaque!(::bevy_utils::Duration`) that impls it as Opaque instead of Struct, rendering it unserializable to Blenvy since it can't access the internal struct members.

Contributor guide

Open the contributing guide

Research direction

Start in crates/bevy_reflect/src/impls/std.rs around the impl_reflect_opaque!(::bevy_utils::Duration) entry. Check the existing reflection implementations and relevant serialization coverage, then verify that Duration is reflected as a Struct exposing secs and nanos rather than as an Opaque value.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
game-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.