You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello everyone, I have tried more than 5 different solutions and none of them worked.
Here are the steps I did:
Added in pubspec.yaml
flutter_unity_widget: ^0.1.6+5
Created unity project in "unity" folder
Copied Build.cs and XCodePostBuild.cs to unity//Assets/Scripts/Editor/
Open your unity project in Unity Editor. Now you can export the Unity project with Flutter/Export Android (for Unity versions up to 2019.2), Flutter/Export Android (Unity 2019.3.*) (for Unity versions 2019.3 and up, which uses the new Unity as a Library export format), or Flutter/Export IOS menu.
Export unity project for android
Wrote a simple script
`import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_unity_widget/flutter_unity_widget.dart';
// Callback that connects the created controller to the unity controller
void onUnityCreated(controller) {
this._unityWidgetController = controller;
}
}
`
6)Added in android: settings.gradle include ':app', ':unity-classes' include ":UnityExport" project(":UnityExport").projectDir = file("./UnityExport")
Hello everyone, I have tried more than 5 different solutions and none of them worked.
Here are the steps I did:
flutter_unity_widget: ^0.1.6+5
Open your unity project in Unity Editor. Now you can export the Unity project with Flutter/Export Android (for Unity versions up to 2019.2), Flutter/Export Android (Unity 2019.3.*) (for Unity versions 2019.3 and up, which uses the new Unity as a Library export format), or Flutter/Export IOS menu.
Export unity project for android
Wrote a simple script
`import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_unity_widget/flutter_unity_widget.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@OverRide
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State {
static final GlobalKey _scaffoldKey =
GlobalKey();
UnityWidgetController _unityWidgetController;
double _sliderValue = 0.0;
@OverRide
void initState() {
super.initState();
}
@OverRide
Widget build(BuildContext context) {
return MaterialApp(
home: UnityDemoScreen(),
);
}
}
class UnityDemoScreen extends StatefulWidget {
UnityDemoScreen({Key key}) : super(key: key);
@OverRide
_UnityDemoScreenState createState() => _UnityDemoScreenState();
}
class _UnityDemoScreenState extends State {
static final GlobalKey _scaffoldKey =
GlobalKey();
UnityWidgetController _unityWidgetController;
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Test003'),
),
key: _scaffoldKey,
body: SafeArea(
bottom: false,
child: WillPopScope(
// ignore: missing_return
onWillPop: () {},
child: Container(
color: Colors.yellow,
child: UnityWidget(
onUnityViewCreated: onUnityCreated,
),
),
),
),
);
}
// Callback that connects the created controller to the unity controller
void onUnityCreated(controller) {
this._unityWidgetController = controller;
}
}
`
6)Added in android: settings.gradle
include ':app', ':unity-classes' include ":UnityExport" project(":UnityExport").projectDir = file("./UnityExport")
But this didn't work
![screen_87](https://user-images.githubusercontent.com/41366638/82927457-6a3dea80-9f89-11ea-98b9-5cc6bc92a2de.png)
log output
idea.log
I tried to add the unity-classes.jar as a module
![screen_88](https://user-images.githubusercontent.com/41366638/82927620-a6714b00-9f89-11ea-9c71-5703153f489b.png)
Accepted this
![screen_89](https://user-images.githubusercontent.com/41366638/82927746-d7ea1680-9f89-11ea-8a76-a972666a1324.png)
Module added in the main directory so I moved it in Android directory
![screen_90](https://user-images.githubusercontent.com/41366638/82927993-331c0900-9f8a-11ea-94c0-70d49db508ee.png)
![screen_91](https://user-images.githubusercontent.com/41366638/82928035-4af38d00-9f8a-11ea-9d87-7d39d73c1dc6.png)
But after this step, I can't build my app
![screen_92](https://user-images.githubusercontent.com/41366638/82928173-88581a80-9f8a-11ea-83e9-6862e654de82.png)
Button for the build isn't working
Before this step:
![screen_93](https://user-images.githubusercontent.com/41366638/82928371-d40ac400-9f8a-11ea-8b53-a90549e38653.png)
How to integrate Unity with flutter?
The text was updated successfully, but these errors were encountered: