-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Running Unity embedded in a subview (iOS) #3
Comments
Hi @SGoerzen, We have experimented with this at Red-Point, with a little bit of success, but haven't made a concerted effort to use MAUI over the top of Unity. It is possible (somewhat) but we found it had a few caveats:
This is a sample of how we were experimenting with it:
We found it worked (somewhat) but it caused issues with touch events inside the 3D player. At this point in time, we won't be pursuing it further. Hopefully that answers your question! |
@matthewrdev Thank you for reply! Sad to hear but it helps a lot. Do you know if it has the same issues on other platforms? (As Unity has mentioned it on their page) Or is it just a MAUI problem? |
@SGoerzen I would image this affects other platforms as Unity explicitly mentions it in their documentation. To use native controls for Unity, the approach is to host them inside the Unity root view, rather than hosting the Unity viewer inside the native control. Best of luck with the project! |
@matthewrdev thanks for your quick answers! tried out the Flutter widget and integrated my AR application into the Flutter app with working gesture control (Vuforia is still to be tested). I really dislike Flutter... but I guess I need to use it for now. For long term: What do you think, would it be possible to adapt this widget for MAUI? I think there is needed to adapt AppDelegate.cs and e.g. translate especially these classes into C# and MAUI: https://github.com/juicycleff/flutter-unity-view-widget/tree/master/ios/Classes Is it worth trying it? |
Hello,
I very like MAUI and your approach. Thanks for that!
It would be nice, if Unity can be somehow embedded in a subview instead of fullscreen. This way it would be easy to overlay MAUI controls over the application. I have seen many similar approach in other stacks (native ObjC, native Swift, ReactNative, Flutter).
I thought about to add another runEmbedded function and map it in maui by providing a UIView.
I am C# expert, but not ObjC or MAUI. So the scripts are not maybe not the correct way, but a first try for achieving this.
Unity project:
Classes/main.mm
add in UnityFramework.h
- (void)runEmbeddedWithArgc:(int)argc argv:(char*[])argv appLaunchOpts:(NSDictionary*)appLaunchOpts inView:(UIView*)parentView;
iOSBridge Project:
ApiDefinitions.cs (interface UnityFramework)
MAUI Project:
Extend UnityBridge.iOS.cs by following
and call this stuff from anywhere by
UnityBridge.ShowUnityWindow(unityHost.ToPlatform(Handler.MauiContext));
, whereunityHost
is a element.Do you have an idea how to solve this use case? @matthewrdev
The text was updated successfully, but these errors were encountered: