DavidPeicho / unity-swiftui-example

Integration example of the Unity engine in a SwiftUI-based application
MIT License
70 stars 15 forks source link

How to mark NavigationView as Passthrough #10

Open JakobWitsch opened 2 years ago

JakobWitsch commented 2 years ago

Hello! If I add a NavigationView the touch Event does not get forwarded to Unity. Do you know a way how to solve this?

ZStack { NavigationView { } Text("Hello World").onAppear { let api = UnityBridge.getInstance() api.show() } }

Akhu commented 2 years ago

Got the same issue I was about to post an issue to know if someone has a solution. Did you find something? For me the Navigation View also hide the Unity view...

Thanks for your helps :)

JakobWitsch commented 2 years ago

Hi. No found no way because Unity lays in the background and the navigation view can not be transparent. I wrote my own navigation bar and it works pretty good this way

Holen Sie sich Outlook für iOShttps://aka.ms/o0ukef


Von: Anthony Da Cruz @.> Gesendet: Monday, June 13, 2022 4:42:49 PM An: DavidPeicho/unity-swiftui-example @.> Cc: JakobWitsch @.>; Author @.> Betreff: Re: [DavidPeicho/unity-swiftui-example] How to mark NavigationView as Passthrough (Issue #10)

Got the same issue I was about to post an issue to know if someone has a solution. Did you find something? For me the Navigation View also hide the Unity view...

Thanks for your helps :)

— Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FDavidPeicho%2Funity-swiftui-example%2Fissues%2F10%23issuecomment-1154012123&data=05%7C01%7C%7C08b1bfaeff6843f8825408da4d4afd03%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637907281714125900%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=8tDS4pCFVB6T09TQjuYDqD9C7zQWhLFBS%2BG8ziH2p%2FM%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAKYUME3KGD4R3W6ISPQFDTLVO5CGTANCNFSM5SO2NYVQ&data=05%7C01%7C%7C08b1bfaeff6843f8825408da4d4afd03%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637907281714282120%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=mvX%2Btb2j1jeGJZOAnOS%2BO6FSTUBbwlKu9uG74j0GXdg%3D&reserved=0. You are receiving this because you authored the thread.Message ID: @.***>

Akhu commented 2 years ago

Ok I see thanks for the answer.

On a side note for the futur people who struggle : I managed to make your solution working for an already existing complex project with SwiftUI.

But using SceneDelegate is breaking some SwiftUI features like Universal Link, and incoming data from the outside of the app. So I ended up by integrating Unity in a UIViewRepresentable which generate other problems but in the end it working by playing with UIWindows.

Warning message from SwiftUI

Cannot use Scene methods for URL, NSUserActivity, and other External Events without using SwiftUI Lifecycle

I will make a repository to treat this case, because not many resources can be found on internet, your blog post was a lighthouse in the dark. Thanks for your work !

Phantom-Addy commented 1 year ago

Any update on this? Making a navigationview a passthrough?