Skip to content

Commit ed47a7e

Browse files
committed
Merge branch 'main-2022' into main-6000
2 parents 971ba9d + 2b80f04 commit ed47a7e

18 files changed

+100
-71
lines changed

README.md

Lines changed: 76 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,74 @@
1-
# flutter_unity_widget
2-
[![All Contributors](https://img.shields.io/badge/all_contributors-4-orange.svg?style=flat-square)](#contributors-)
1+
# flutter_unity_widget_2
2+
This plugin is a fork of [flutter_unity_widget](https://pub.dev/packages/flutter_unity_widget), which is outdated on pub.dev.
33

4-
[![version][version-badge]][package]
5-
[![MIT License][license-badge]][license]
6-
[![PRs Welcome][prs-badge]](https://makeapullrequest.com)
4+
The aim of this fork is to publish bug fixes and improve compatibility with newer Flutter and Unity versions.
5+
These changes come from the master branch of the original [Github repo](https://github.com/juicycleff/flutter-unity-view-widget), which is far ahead of it's latest pub.dev release.
76

8-
[![Watch on GitHub][github-watch-badge]][github-watch]
9-
[![Star on GitHub][github-star-badge]][github-star]
107

11-
[![Gitter](https://badges.gitter.im/flutter-unity/community.svg)](https://gitter.im/flutter-unity/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
8+
Don't expect major new features or rewrites for now, as this plugin will try to stick close to the original.
9+
If you are looking for a full rewrite of the Unity integration, try [flutter_embed_unity](https://pub.dev/packages/flutter_embed_unity) instead.
10+
11+
12+
* Plugin versions `2022.x.y` should support Unity 2019.4 up to Unity 2022.3.
13+
The main focus is on Unity 2022.3 LTS.
14+
* Plugin versions `6000.x.y` support Unity 6 and up.
15+
16+
17+
This plugin works with the same [unitypackages](https://github.com/juicycleff/flutter-unity-view-widget/tree/master/unitypackages) as the original plugin.
18+
19+
<br />
20+
21+
22+
23+
For now, most of the original readme is included below for documentation.
24+
I might expand on this later.
25+
26+
27+
## Migration from flutter_unity_widget
28+
I've tried to keep most internal classes identical, to keep migrating to the fork simple.
29+
30+
You just need to rename the plugin by adding `_2` in several files in your project:
31+
32+
1. `pubspec.yaml`
33+
```diff
34+
dependencies:
35+
- flutter_unity_widget: ^2022.2.1
36+
+ flutter_unity_widget_2: ^2022.2.2
37+
```
38+
39+
2. Dart files in your Flutter project.
40+
```diff
41+
- import 'package:flutter_unity_widget/flutter_unity_widget.dart';
42+
+ import 'package:flutter_unity_widget_2/flutter_unity_widget.dart';
43+
```
44+
45+
3. Your `android/app/build.gradle`file.
46+
```diff
47+
// android/app/build.gradle
48+
- implementation project(':flutter_unity_widget')
49+
+ implementation project(':flutter_unity_widget_2')
50+
51+
// android/app/build.gradle.kts (Flutter 3.29+)
52+
- implementation(project(":flutter_unity_widget"))
53+
+ implementation(project(":flutter_unity_widget_2"))
54+
```
55+
56+
4. Your `ios/Runner/AppDelegate.swift`.
57+
```diff
58+
- import flutter_unity_widget
59+
+ import flutter_unity_widget_2
60+
```
61+
62+
<br />
63+
<br />
64+
<br />
65+
<br />
66+
<br />
67+
68+
69+
70+
# Original Readme
71+
1272
[![Discord](https://img.shields.io/badge/Discord-blue?style=for-the-badge)](https://discord.gg/KmMqD7Sv3K)
1373

1474
Flutter unity 3D widget for embedding unity in flutter. Now you can make awesome gamified features of your app in Unity and get it rendered in a Flutter app both in fullscreen and embeddable mode. Works great on `Android, iPad OS, iOS, Web`.
@@ -19,14 +79,10 @@ Flutter unity 3D widget for embedding unity in flutter. Now you can make awesome
1979
- Use Windows or Mac to export and build your project.
2080
Users on Ubuntu have reported a lot of errors in the Unity export.
2181
- Emulator support is limited and requires special setup. Please use a physical device for Android and iOS.
22-
- Supports Unity 2019.4.3 up to 2022.3.x, we recommend the latest 2022.3 LTS.
23-
Check [this github issue](https://github.com/juicycleff/flutter-unity-view-widget/issues/967) for support of Unity 6.
2482
- Use only OpenGLES3 as Graphics API on Android for AR compatibility.
2583
- Windows isn't supported because of the lack of [Flutter PlatformView support](https://github.com/flutter/flutter/issues/31713).
2684

2785
## Notice
28-
Need me to respond, tag me [Rex Isaac Raphael](https://github.com/juicycleff).
29-
3086
This plugin expects you to atleast know how to use Unity Engine. If you have issues with how unity widget is presented, you can please modify your unity project build settings as you seem fit.
3187

3288
Moving forward, versioning of the package will change to match unity releases after proper test. Mind you this does not mean the package
@@ -39,13 +95,13 @@ This plugin requires Flutter >= 3.3.0
3995
First depend on the library by adding this to your packages `pubspec.yaml`:
4096
```yaml
4197
dependencies:
42-
flutter_unity_widget: ^2022.2.1 # use the latest compatible version
98+
flutter_unity_widget_2: ^2022.2.2 # use the latest compatible version
4399
```
44100
45101
Now inside your Dart code you can import it.
46102
47103
```dart
48-
import 'package:flutter_unity_widget/flutter_unity_widget.dart';
104+
import 'package:flutter_unity_widget_2/flutter_unity_widget.dart';
49105
```
50106

51107
You will need to open and export a Unity project, even for running the example. Your build will fail if you only include the widget in Flutter!
@@ -180,17 +236,16 @@ Check the **Minimum API Level** setting in the Unity player settings, and match
180236
The Unity widget will function without this step, but some Unity plugins like ArFoundation will throw `mUnityPlayer` errors on newer Unity versions.
181237

182238
This is needed for Unity 2020.3.46+, 2021.3.19 - 2021.3.20 and 2022.2.4 - 2022.3.18.
183-
This requires a flutter_unity_widget version that is newer than 2022.2.1.
184239

185240

186241
- 3.1. Open the `android/app/build.gradle` file and add the following:
187242

188243
```diff
189244
dependencies {
190245
// build.gradle
191-
+ implementation project(':flutter_unity_widget')
246+
+ implementation project(':flutter_unity_widget_2')
192247
// build.gradle.kts (Flutter 3.29+)
193-
+ implementation(project(":flutter_unity_widget"))
248+
+ implementation(project(":flutter_unity_widget_2"))
194249
}
195250
```
196251
- 3.2. Edit your android MainActivity file.
@@ -342,7 +397,7 @@ allprojects {
342397
```diff
343398
import UIKit
344399
import Flutter
345-
+ import flutter_unity_widget
400+
+ import flutter_unity_widget_2
346401

347402
@UIApplicationMain
348403
@objc class AppDelegate: FlutterAppDelegate {
@@ -360,7 +415,7 @@ allprojects {
360415

361416
3.2. If you're using Objective-C, open the *ios/Runner/main.m* file and change the following:
362417
```diff
363-
+ #import "flutter_unity_widget.swift.h"
418+
+ #import "flutter_unity_widget_2.swift.h"
364419

365420
int main(int argc, char * argv[]) {
366421
@autoreleasepool {
@@ -590,7 +645,7 @@ If you computer does not have an ARM processor, like most computers running on I
590645

591646
```dart
592647
import 'package:flutter/material.dart';
593-
import 'package:flutter_unity_widget/flutter_unity_widget.dart';
648+
import 'package:flutter_unity_widget_2/flutter_unity_widget.dart';
594649
595650
void main() {
596651
runApp(
@@ -647,7 +702,7 @@ class _UnityDemoScreenState extends State<UnityDemoScreen> {
647702

648703
```dart
649704
import 'package:flutter/material.dart';
650-
import 'package:flutter_unity_widget/flutter_unity_widget.dart';
705+
import 'package:flutter_unity_widget_2/flutter_unity_widget.dart';
651706
652707
void main() => runApp(const MyApp());
653708
@@ -1021,32 +1076,6 @@ Stack(
10211076
We already integrated this into our [Examples](/example/lib/screens/) in the `/example` folder.
10221077

10231078

1024-
#### Sponsors
1025-
1026-
Support this project with your organization. Your donations will be used to help children first and then those in need. Your logo will show up here with a link to your website. [[Contribute](https://opencollective.com/ultimate-backend/contribute)]
1027-
1028-
<a href="https://opencollective.com/ultimate-backend/sponsor/0/website"><img src="https://opencollective.com/ultimate-backend/sponsor/0/avatar.svg"></a>
1029-
<a href="https://opencollective.com/ultimate-backend/sponsor/1/website"><img src="https://opencollective.com/ultimate-backend/sponsor/1/avatar.svg"></a>
1030-
<a href="https://opencollective.com/ultimate-backend/sponsor/2/website"><img src="https://opencollective.com/ultimate-backend/sponsor/2/avatar.svg"></a>
1031-
<a href="https://opencollective.com/ultimate-backend/sponsor/3/website"><img src="https://opencollective.com/ultimate-backend/sponsor/3/avatar.svg"></a>
1032-
<a href="https://opencollective.com/ultimate-backend/sponsor/4/website"><img src="https://opencollective.com/ultimate-backend/sponsor/4/avatar.svg"></a>
1033-
<a href="https://opencollective.com/ultimate-backend/sponsor/5/website"><img src="https://opencollective.com/ultimate-backend/sponsor/5/avatar.svg"></a>
1034-
<a href="https://opencollective.com/ultimate-backend/sponsor/6/website"><img src="https://opencollective.com/ultimate-backend/sponsor/6/avatar.svg"></a>
1035-
<a href="https://opencollective.com/ultimate-backend/sponsor/7/website"><img src="https://opencollective.com/ultimate-backend/sponsor/7/avatar.svg"></a>
1036-
<a href="https://opencollective.com/ultimate-backend/sponsor/8/website"><img src="https://opencollective.com/ultimate-backend/sponsor/8/avatar.svg"></a>
1037-
<a href="https://opencollective.com/ultimate-backend/sponsor/9/website"><img src="https://opencollective.com/ultimate-backend/sponsor/9/avatar.svg"></a>
1038-
1039-
[version-badge]: https://img.shields.io/pub/v/flutter_unity_widget.svg?style=flat-square
1040-
[package]: https://pub.dartlang.org/packages/flutter_unity_widget/
1041-
[license-badge]: https://img.shields.io/github/license/juicycleff/flutter-unity-view-widget.svg?style=flat-square
1042-
[license]: https://github.com/juicycleff/flutter-unity-view-widget/blob/master/LICENSE
1043-
[prs-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square
1044-
[prs]: https://makeapullrequest.com
1045-
[github-watch-badge]: https://img.shields.io/github/watchers/juicycleff/flutter-unity-view-widget.svg?style=social
1046-
[github-watch]: https://github.com/juicycleff/flutter-unity-view-widget/watchers
1047-
[github-star-badge]: https://img.shields.io/github/stars/juicycleff/flutter-unity-view-widget.svg?style=social
1048-
[github-star]: https://github.com/juicycleff/flutter-unity-view-widget/stargazers
1049-
10501079
## Contributors ✨
10511080

10521081
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):

android/settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
rootProject.name = 'flutter_unity_widget'
1+
rootProject.name = 'flutter_unity_widget_2'

example/android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@ flutter {
5151

5252
dependencies {
5353
implementation project(':unityLibrary')
54-
implementation project(':flutter_unity_widget')
54+
implementation project(':flutter_unity_widget_2')
5555
}

example/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ subprojects {
2525
if (project.plugins.hasPlugin("com.android.application")
2626
|| project.plugins.hasPlugin("com.android.library")) {
2727

28-
if (project.name == "flutter_unity_widget") {
28+
if (project.name == "flutter_unity_widget_2") {
2929
project.android {
3030
// add namespace if it is missing
3131
if (namespace == null) {

example/ios/Runner/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import UIKit
22
import Flutter
3-
import flutter_unity_widget
3+
import flutter_unity_widget_2
44

55
@UIApplicationMain
66
@objc class AppDelegate: FlutterAppDelegate {

example/lib/screens/api_screen.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// ignore_for_file: avoid_print
22

33
import 'package:flutter/material.dart';
4-
import 'package:flutter_unity_widget/flutter_unity_widget.dart';
4+
import 'package:flutter_unity_widget_2/flutter_unity_widget.dart';
55
import 'package:pointer_interceptor/pointer_interceptor.dart';
66

77
class ApiScreen extends StatefulWidget {

example/lib/screens/loader_screen.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// ignore_for_file: avoid_print
22

33
import 'package:flutter/material.dart';
4-
import 'package:flutter_unity_widget/flutter_unity_widget.dart';
4+
import 'package:flutter_unity_widget_2/flutter_unity_widget.dart';
55
import 'package:pointer_interceptor/pointer_interceptor.dart';
66

77
class LoaderScreen extends StatefulWidget {

example/lib/screens/no_interaction_screen.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import 'package:flutter/material.dart';
2-
import 'package:flutter_unity_widget/flutter_unity_widget.dart';
2+
import 'package:flutter_unity_widget_2/flutter_unity_widget.dart';
33
import 'package:pointer_interceptor/pointer_interceptor.dart';
44

55
class NoInteractionScreen extends StatefulWidget {

example/lib/screens/orientation_screen.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import 'package:flutter/material.dart';
22
import 'package:flutter/services.dart';
3-
import 'package:flutter_unity_widget/flutter_unity_widget.dart';
3+
import 'package:flutter_unity_widget_2/flutter_unity_widget.dart';
44
import 'package:pointer_interceptor/pointer_interceptor.dart';
55

66
class OrientationScreen extends StatefulWidget {

example/lib/screens/simple_screen.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import 'package:flutter/material.dart';
2-
import 'package:flutter_unity_widget/flutter_unity_widget.dart';
2+
import 'package:flutter_unity_widget_2/flutter_unity_widget.dart';
33
import 'package:pointer_interceptor/pointer_interceptor.dart';
44

55
class SimpleScreen extends StatefulWidget {

0 commit comments

Comments
 (0)