Skip to content

Default Text initialization with no font specified #1201

@eliasreid

Description

@eliasreid

Bevy version

0.4.0

Operating system & version

Windows 10

What you did

Spawned a TextBundle using a mostly defaulted Text struct (only specified the value).

  commands
    .spawn(CameraUiBundle::default())
    .spawn(TextBundle{
      text: Text{
        value: "test text".to_string(),
        ..Default::default()
      },
      ..Default::default()
    })

What you expected to happen

I expected that one of two things would happen:

  1. Error message due to trying to render text without specifying a font. (either compile time by not having Text be default-able, or run time)
  2. Have a default font be used.

What actually happened

The app builds and runs fine, but the text doesn't show on screen (which makes sense, as there is no font specified).

Initializing the Text struct with a font worked as expected. (adding ...font: asset_server.load("fonts/font_name.ttf"),...

Additional information

This may be intended behaviour, but I found it unexpected as a new user of Bevy. I see that there exists an issue for adding a built-in font (#1017), which would address the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-UIGraphical user interfaces, styles, layouts, and widgetsC-BugAn unexpected or incorrect behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions