bevyengine / bevyengine/bevy

iOS build crashes on camera pan

Open
#15,960 0 comments 0 reactions 0 assignees View on GitHub
A-Rendering C-Bug O-iOS S-Needs-Investigation
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## Bevy version

0.14.2 and also on master (#15953).

```ignore
AdapterInfo { name: "Apple iOS simulator GPU", vendor: 0, device: 0, device_type: DiscreteGpu, driver: "", driver_info: "", backend: Metal }
```

## What you did

Attempting to pan the camera towards right by incrementing `translation.x =+ 0.5` in `Update`.

## What went wrong

It crashes on both iOS Simulator (newest iPhone 16 with newest iOS 18) as well as on real hardware (also tested on iOS 18). The error message is the same on both:

```
-[MTLDebugComputeCommandEncoder dispatchThreadgroups:threadsPerThreadgroup:]:1293: failed assertion `(threadgroupsPerGrid.width(0) * threadgroupsPerGrid.y(1) * threadgroupsPerGrid.depth(1))(0) must not be 0.'
```

But it's not limited to the camera. It also crashes when moving the cuboid. Also note that everything works fine on macOS. It even works fine on iOS when the app is started regularly from the homescreen (as opposed to starting it using the Xcode play button).

## Additional information

To reproduce:

1. Clone the Bevy repo
2. In `examples/mobile/src/lib.rs` add a system that pans the camera (see snippet below)
3. Start Xcode and open `examples/mobile/bevy_mobile_example.xcodeproj`
4. Hit the play button, it will crash after a few seconds

```
// Don't forget to add it like .add_systems(Update, pan_camera_right)
fn pan_camera_right(mut camera_transform: Single<&mut Transform, With>) {
println!("x is {}", camera_transform.translation.x);
camera_transform.translation.x += 0.05;
}
```

Note that it also fails when decreasing, and also on the x and z axis (at least in one direction).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.