fix for issues on ios
This commit is contained in:
parent
1cfa3630c0
commit
c9816b606a
|
@ -1,3 +1,11 @@
|
||||||
|
## 0.1.6+8
|
||||||
|
|
||||||
|
* Breaking change for unityframework iOS
|
||||||
|
|
||||||
|
## 0.1.6+7
|
||||||
|
|
||||||
|
* Breaking change for unityframework iOS
|
||||||
|
|
||||||
## 0.1.6+6
|
## 0.1.6+6
|
||||||
|
|
||||||
* Breaking change for unityframework iOS
|
* Breaking change for unityframework iOS
|
||||||
|
|
|
@ -17,7 +17,7 @@ Flutter unity 3D widget for embedding unity in flutter. Now you can make awesome
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
dependencies:
|
dependencies:
|
||||||
flutter_unity_widget: ^0.1.6+5
|
flutter_unity_widget: ^0.1.6+8
|
||||||
```
|
```
|
||||||
|
|
||||||
Now inside your Dart code you can import it.
|
Now inside your Dart code you can import it.
|
||||||
|
@ -84,6 +84,8 @@ Be sure you have at least one scene added to your build.
|
||||||
**iOS Platform**:
|
**iOS Platform**:
|
||||||
1. This only works with Unity version >=2019.3 because uses Unity as a library!
|
1. This only works with Unity version >=2019.3 because uses Unity as a library!
|
||||||
2. Depending on where you want to test or run your app, (simulator or physical device), you should select the appropriate SDK on `Target SDK`.
|
2. Depending on where you want to test or run your app, (simulator or physical device), you should select the appropriate SDK on `Target SDK`.
|
||||||
|
3. Add this to the flutter app Info.plist ```<key>io.flutter.embedded_views_preview</key>
|
||||||
|
<true/>```
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|
|
@ -11,8 +11,10 @@ static const int constsection = 0;
|
||||||
|
|
||||||
bool unity_inited = false;
|
bool unity_inited = false;
|
||||||
|
|
||||||
|
// keep arg for unity init from non main
|
||||||
int g_argc;
|
int g_argc;
|
||||||
char** g_argv;
|
char** g_argv;
|
||||||
|
NSDictionary* appLaunchOpts;
|
||||||
|
|
||||||
void UnityInitTrampoline();
|
void UnityInitTrampoline();
|
||||||
|
|
||||||
|
@ -38,17 +40,7 @@ UnityFramework* UnityFrameworkLoad()
|
||||||
NSBundle* bundle = [NSBundle bundleWithPath: bundlePath];
|
NSBundle* bundle = [NSBundle bundleWithPath: bundlePath];
|
||||||
if ([bundle isLoaded] == false) [bundle load];
|
if ([bundle isLoaded] == false) [bundle load];
|
||||||
|
|
||||||
|
|
||||||
UnityFramework* ufw = [bundle.principalClass getInstance];
|
UnityFramework* ufw = [bundle.principalClass getInstance];
|
||||||
if (![ufw appController])
|
|
||||||
{
|
|
||||||
// Initialize Unity for a first time
|
|
||||||
[ufw setExecuteHeader: &_mh_execute_header];
|
|
||||||
|
|
||||||
// Keep in sync with Data folder Target Membership setting
|
|
||||||
[ufw setDataBundleId: "com.unity3d.framework"];
|
|
||||||
|
|
||||||
}
|
|
||||||
return ufw;
|
return ufw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,8 +53,10 @@ extern "C" void InitUnity()
|
||||||
|
|
||||||
ufw = UnityFrameworkLoad();
|
ufw = UnityFrameworkLoad();
|
||||||
|
|
||||||
// [ufw setDataBundleId: "com.unity3d.framework"];
|
[ufw setDataBundleId: "com.unity3d.framework"];
|
||||||
// [ufw frameworkWarmup: g_argc argv: g_argv];
|
[ufw frameworkWarmup: g_argc argv: g_argv];
|
||||||
|
// [ufw setExecuteHeader: &_mh_execute_header];
|
||||||
|
// [ufw runEmbeddedWithArgc: gArgc argv: gArgv appLaunchOpts: appLaunchOpts];
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void UnityPostMessage(NSString* gameObject, NSString* methodName, NSString* message)
|
extern "C" void UnityPostMessage(NSString* gameObject, NSString* methodName, NSString* message)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
name: flutter_unity_widget
|
name: flutter_unity_widget
|
||||||
description: Flutter Unity 3D widget for embedding Unity game scenes in flutter. This library now supports Unity as a Library.
|
description: Flutter Unity 3D widget for embedding Unity game scenes in flutter. This library now supports Unity as a Library.
|
||||||
version: 0.1.6+6
|
version: 0.1.6+8
|
||||||
#authors:
|
#authors:
|
||||||
# - Rex Raphael <rex.raphael@outlook.com>
|
# - Rex Raphael <rex.raphael@outlook.com>
|
||||||
# - Thomas Stockx <thomas@stockxit.com>
|
# - Thomas Stockx <thomas@stockxit.com>
|
||||||
|
|
Reference in New Issue