SIGN IN SIGN UP
bevyengine / bevy UNCLAIMED

A refreshingly simple data-driven game engine built in Rust

0 0 0 Rust

added serde(default) to Transform (#23474)

# Objective

Need serde(Default) for Transform. I think it would be very useful in
cases where someone wants to add an object to their scene but doesn't
want to have to specify rotation or scale, e.g.:

```
5: (
  components: {
    "common::types::GameObjectKind": Rifle,
    "bevy_transform::components::transform::Transform": (
      translation: (1.5, 800.0, 0.0),
    ),
  },
),
```

## Solution

Added `#[cfg_attr(feature = "serialize", serde(default))]` before the
Transform struct.

## Testing

Successfully built bevy, but haven't tested extensively. Theoretically
shouldn't break existing functionality, since Deriving Transform was
invalid before this PR.
G
GHowe committed
2e1acb9d889a769a74e78448e4e406df375b3c7d
Parent: 09ef09e
Committed by GitHub <noreply@github.com> on 4/2/2026, 7:23:25 PM