MrGVSV / bevy_proto

Create config files for entities in Bevy
Other
239 stars 25 forks source link

Unwrap error when using ButtonBundle #44

Closed hafiidz closed 1 year ago

hafiidz commented 1 year ago

Hi, I am encountering consistent crash & couldn't get the button text to show up when I tried to enter a simple ButtonBundle. I have tested when removing the ButtonBundle, the rest of the MenuPlay.prototype.ron is working fine. It seems to be happening during state transition, i.e. when moving away for the spawned menu (i.e. despawning).

(
  name: "MenuPlay",
  schematics: {
    "bevy_proto::custom::NodeBundle": (
      style: (
        flex_direction: Row,
        justify_content: SpaceAround,
        align_items: Center,
        size: (
          width: Auto,
          height: Px(64.0),
        ),
      ),
      background_color: (Rgba(
        red: 0.5,
        green: 0.15,
        blue: 0.15,
        alpha: 1.0
      )),
    )
  },
  children: [(
        value: Inline((
          name: "Play Button",
          schematics: {
            "bevy_proto::custom::ButtonBundle": (
              style: (
                size: (
                  width: Px(64.0),
                  height: Px(32.0),
                ),
              ),
            ),
          },
          children: [(
            value: Inline((
              name: "Play Text",
              schematics: {
                "bevy_proto::custom::TextBundle": (
                  text: (
                    sections: [(
                      // Label for Play Button
                      value: "Play",
                      style: (
                        font: AssetPath("fonts/FiraSans-Bold.ttf"),
                        font_size: 15.0,
                        color: White,
                      )
                    )]
                  ),
                ),
              }
            ))
          )]
        ))
      ),
  ]
)
thread 'Compute Task Pool (5)' panicked at 'called `Option::unwrap()` on a `None` value', C:\Users\hafiidz\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_ui-0.10.1\src\render\mod.rs:608:70
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'Compute Task Pool (5)' panicked at 'A system has panicked so the executor cannot continue.: RecvError', C:\Users\hafiidz\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_ecs-0.10.1\src\schedule\executor\multi_threaded.rs:194:60
thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', C:\Users\hafiidz\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_tasks-0.10.1\src\task_pool.rs:376:49
thread 'Compute Task Pool (5)' panicked at 'called `Result::unwrap()` on an `Err` value: RecvError', C:\Users\hafiidz\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_render-0.10.1\src\pipelined_rendering.rs:136:45
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', C:\Users\hafiidz\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_tasks-0.10.1\src\task_pool.rs:376:49
error: process didn't exit successfully: `target\debug\deck_proto.exe` (exit code: 101)

Not sure what else do I need to provide here to help diagnose the problem.

hafiidz commented 1 year ago

Just updating this with a reproducible simple example. Do note that I am using a local bevy_proto with one minor changes to lock to bevy=0.10.1 version, as mentioned in PR#45 to avoid versioning conflict.

Working okay with a normal node: https://github.com/hafiidz/bevy_snippets/tree/main

Cannot run with error with Button Bundle: https://github.com/hafiidz/bevy_snippets/tree/add-button-bundle

The changes are only in assets/MenuPlay.prototype.ron as outlined here:

https://github.com/hafiidz/bevy_snippets/commit/dd454446062530ecb86ee73a742da26e3d2819c2

MrGVSV commented 1 year ago

@hafiidz is this still an issue with #45? Trying to replicate it myself and I'm not getting a panic (when using that branch anyways).

hafiidz commented 1 year ago

A quick update, manage to get it running properly now. Thank you very much!