i upgraded my app to use visionos2 sdk. but now my tap wont work on a button in a vgrid, any ideas what might have messed up my tap gesture? this tap is on a button thats on flat UI displayed in a volumetric window

Asked on 08/08/2024

1 search

It sounds like your tap gesture on a button in a VGrid within a volumetric window in visionOS 2 isn't working as expected. Here are a few things you might want to check based on the information from WWDC sessions:

  1. Input Target and Collision Components: Ensure that your button has both an input target component and a collision component. These are necessary for the entity to be tappable in visionOS. You can find more details on this in the session Explore game input in visionOS.

  2. Gesture Attachment: Make sure that the gesture is attached to the reality view that contains your entities. This is crucial for the gesture to be recognized and handled correctly. More information can be found in the same session Explore game input in visionOS.

  3. System Gestures: If you are using system gestures, ensure that they are correctly implemented. System gestures are supported across all spaces in visionOS, and they should work out of the box if implemented correctly. Refer to the session Explore game input in visionOS for more details.

  4. Custom Gestures: If you are using custom gestures, ensure that they are correctly defined and that all necessary joints for hand tracking are being checked. This is especially important if your app is in a full space where ARKit and hand tracking are available. You can find more information on creating custom gestures in the session Explore game input in visionOS.

  5. SwiftUI and UIKit Coordination: If your app uses both SwiftUI and UIKit, ensure that the gesture recognizers are coordinated properly. You can set failure requirements between gesture recognizers to ensure they don't interfere with each other. More details can be found in the session What’s new in UIKit.

By checking these aspects, you should be able to identify and resolve the issue with your tap gesture. If the problem persists, you might want to review the relevant WWDC sessions in more detail or consult the official documentation for further guidance.