👨‍💻
MYTY
MYTY SDK
MYTY SDK
  • MYTY SDK
  • How to use MYTY SDK?
    • Create Unity Project
    • Import MYTY Kit
    • Import MYTY SDK
    • Build MYTY SDK
    • Create Scene
  • MYTY SDK Interface
    • Load Avatar
    • Select Avatar
    • Choose View Mode
    • Control Avatar (Mediapipe)
    • Control Avatar (ARKit)
  • For Web Application
    • Interacting with browser scripting
    • Integrate with React Project
  • React Example
    • Handle WebGL view & interaction
    • Choose Video Device for input
    • Handle Mediapipe Holistic
    • Capture & Record
  • For iOS Application
    • Interact with native iOS application
    • Integrate with Flutter Project
    • Trouble Shooting (Flutter Integration)
  • Flutter Example
    • Handle UnityWidget & interaction
    • Use ARKit Plugin
  • Avatar Registry(API)
    • Overview
    • Getting Started
    • Auth & Rate Limit
    • Legacy - v0
  • Resources
    • License Agreement
    • Version Note (SDK vs Kit)
    • Display Logo
Powered by GitBook
On this page
  • Flutter Unity Widget
  • Configuration
  1. For iOS Application

Integrate with Flutter Project

PreviousInteract with native iOS applicationNextTrouble Shooting (Flutter Integration)

Last updated 2 years ago

Flutter Unity Widget

This is an open-source project that helps developers to easily integrate Flutter Project with Unity. It includes simple interface to send message to Unity, receive message from Unity, and embed Unity Widget as a component of Flutter Project

Configuration

Following steps are required to embed Unity inside your Flutter project

  1. Open the ios/Runner.xcworkspace (workspace, not the project) file in Xcode, right-click on the Navigator (not on an item), go to Add Files to "Runner" and add the ios/UnityLibrary/Unity-Iphone.xcodeproj file.

  1. Open the ios/Runner/AppDelegate.swift file and change the following:

     import UIKit
     import Flutter
+    import flutter_unity_widget

     @UIApplicationMain
     @objc class AppDelegate: FlutterAppDelegate {
         override func application(
             _ application: UIApplication,
             didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
         ) -> Bool {
+            InitUnityIntegrationWithOptions(argc: CommandLine.argc, argv: CommandLine.unsafeArgv, launchOptions)

             GeneratedPluginRegistrant.register(with: self)
             return super.application(application, didFinishLaunchingWithOptions: launchOptions)
         }
     }
  1. Add the UnityFramework.framework file as a library to the Runner project

Even with these configurations, there might be a problem launching the application. Please refer to the section below to resolve problems.

An example of Flutter-Unity integrated MYTY Avatar project can be found in the section below.

Trouble Shooting (Flutter Integration)
Flutter Example
Unity-iPhone added
UnityFramework.framework added
LogoGitHub - juicycleff/flutter-unity-view-widget: Embeddable unity game engine view for Flutter. Advance demo here https://github.com/juicycleff/flutter-unity-arkit-demoGitHub