Merge pull request #61 from thomas-stockx/feature/new_examples

New example with Flutter <-> Unity communcation & iOS fixes
This commit is contained in:
Rex Raphael 2019-10-17 15:09:28 +02:00 committed by GitHub
commit 8bdf900354
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 1410 additions and 1063 deletions

109
README.md
View File

@ -208,68 +208,95 @@ class _UnityDemoScreenState extends State<UnityDemoScreen>{
```dart
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_unity_widget/flutter_unity_widget.dart';
class UnityDemoScreen extends StatefulWidget {
UnityDemoScreen({Key key}) : super(key: key);
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_UnityDemoScreenState createState() => _UnityDemoScreenState();
_MyAppState createState() => _MyAppState();
}
class _UnityDemoScreenState extends State<UnityDemoScreen>{
class _MyAppState extends State<MyApp> {
static final GlobalKey<ScaffoldState> _scaffoldKey =
GlobalKey<ScaffoldState>();
UnityWidgetController _unityWidgetController;
bool paused = false;
double _sliderValue = 0.0;
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
key: _scaffoldKey,
body: Scaffold(
return MaterialApp(
home: Scaffold(
key: _scaffoldKey,
appBar: AppBar(
title: const Text('Unity Flutter Demo'),
),
body: Container(
child: Stack(
children: <Widget>[
UnityWidget(
onUnityViewCreated: onUnityCreated,
),
Positioned(
bottom: 40.0,
left: 80.0,
right: 80.0,
child: MaterialButton(
onPressed: () {
if(paused) {
_unityWidgetController.resume();
setState(() {
paused = false;
});
} else {
_unityWidgetController.pause();
setState(() {
paused = true;
});
}
},
color: Colors.blue[500],
child: Text(paused ? 'Start Game' : 'Pause Game'),
body: Card(
margin: const EdgeInsets.all(8),
clipBehavior: Clip.antiAlias,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20.0),
),
child: Stack(
children: <Widget>[
UnityWidget(
onUnityViewCreated: onUnityCreated,
isARScene: false,
onUnityMessage: onUnityMessage,
),
),
],
)),
Positioned(
bottom: 20,
left: 20,
right: 20,
child: Card(
elevation: 10,
child: Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.only(top: 20),
child: Text("Rotation speed:"),
),
Slider(
onChanged: (value) {
setState(() {
_sliderValue = value;
});
setRotationSpeed(value.toString());
},
value: _sliderValue,
min: 0,
max: 20,
),
],
),
),
),
],
),
),
),
);
}
// Communcation from Flutter to Unity
void setRotationSpeed(String speed) {
_unityWidgetController.postMessage(
'Cube',
'SetRotationSpeed',
speed,
);
}
// Communication from Unity to Flutter
void onUnityMessage(controller, message) {
print('Received message from unity: ${message.toString()}');
}
// Callback that connects the created controller to the unity controller
void onUnityCreated(controller) {
this._unityWidgetController = controller;

8
example/.gitignore vendored
View File

@ -29,6 +29,8 @@
build/
android/UnityExport/
ios/UnityExport/
unity/DemoApp/.vs
#example/
example/unity/DemoApp/Builds/
@ -44,6 +46,8 @@ example/unity/DemoApp/Temp/
**/android/gradlew.bat
**/android/local.properties
**/android/**/GeneratedPluginRegistrant.java
**/android/key.properties
*.jks
# iOS/XCode related
**/ios/**/*.mode1v3
@ -68,9 +72,13 @@ example/unity/DemoApp/Temp/
**/ios/Flutter/app.flx
**/ios/Flutter/app.zip
**/ios/Flutter/flutter_assets/
**/ios/Flutter/flutter_export_environment.sh
**/ios/ServiceDefinitions.json
**/ios/Runner/GeneratedPluginRegistrant.*
# Coverage
coverage/
# Exceptions to above rules.
!**/ios/**/default.mode1v3
!**/ios/**/default.mode2v3

View File

@ -2,15 +2,21 @@
Demonstrates how to use the flutter_unity_widget plugin.
## Getting Started
## Run the sample on Android
This project is a starting point for a Flutter application.
1. Open the `unity` project and build it: Menu -> Flutter -> Export Android
2. Copy `android/UnityExport/libs/unity-classes.jar` to `android/unity-classes/unity-classes.jar` and overwrite the existing file. You only need to do this each time you use a different Unity version.
3. `flutter run`
A few resources to get you started if this is your first Flutter project:
- [Lab: Write your first Flutter app](https://flutter.io/docs/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://flutter.io/docs/cookbook)
For help getting started with Flutter, view our
[online documentation](https://flutter.io/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
## Run the sample on iOS
1. Open the `unity` project and build it: Menu -> Flutter -> Export iOS
Be sure you use at least Unity version 2019.3 or up.
2. open ios/Runner.xcworkspace (workspace!, not the project) in Xcode and add the exported project in the workspace root (with a right click in the Navigator, not on an item -> Add Files to "Runner" -> add the UnityExport/Unity-Iphone.xcodeproj file
<img src="../workspace.png" width="400" />
3. Select the Unity-iPhone/Data folder and change the Target Membership for Data folder to UnityFramework
<img src="../change_target_membership_data_folder.png" width="400" />
4. `flutter run`

View File

@ -25,7 +25,7 @@ apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 27
compileSdkVersion 28
lintOptions {
disable 'InvalidPackage'
@ -34,8 +34,8 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.rexraphael.flutterunitywidgetexample"
minSdkVersion 16
targetSdkVersion 27
minSdkVersion 19
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

View File

@ -1 +1,2 @@
org.gradle.jvmargs=-Xmx1536M
android.enableR8=true

View File

@ -8,6 +8,8 @@
/* Begin PBXBuildFile section */
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
3595962B23575428001EA3CF /* UnityFramework.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3595962823575079001EA3CF /* UnityFramework.framework */; };
3595962C23575428001EA3CF /* UnityFramework.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3595962823575079001EA3CF /* UnityFramework.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };
3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
@ -30,6 +32,7 @@
files = (
3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */,
9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */,
3595962C23575428001EA3CF /* UnityFramework.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
@ -39,6 +42,7 @@
/* Begin PBXFileReference section */
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
3595962823575079001EA3CF /* UnityFramework.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = UnityFramework.framework; sourceTree = BUILT_PRODUCTS_DIR; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = "<group>"; };
5620DF288C51424FA6A1FF33 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
@ -66,6 +70,7 @@
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */,
3B80C3941E831B6300D905FE /* App.framework in Frameworks */,
5F1F17FE81D542008A531ACA /* Pods_Runner.framework in Frameworks */,
3595962B23575428001EA3CF /* UnityFramework.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -75,6 +80,7 @@
1944B714B8EB58E1422F85BA /* Frameworks */ = {
isa = PBXGroup;
children = (
3595962823575079001EA3CF /* UnityFramework.framework */,
5620DF288C51424FA6A1FF33 /* Pods_Runner.framework */,
);
name = Frameworks;
@ -87,7 +93,6 @@
AE2B2FAD9E6F467609AF130E /* Pods-Runner.release.xcconfig */,
BBFDA20C1C79A585B3EBC21F /* Pods-Runner.profile.xcconfig */,
);
name = Pods;
path = Pods;
sourceTree = "<group>";
};
@ -191,6 +196,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
);
@ -239,16 +245,12 @@
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
"${PODS_ROOT}/../.symlinks/flutter/ios-release/Flutter.framework",
"${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework",
"${BUILT_PRODUCTS_DIR}/flutter_unity_widget/flutter_unity_widget.framework",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
);
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_unity_widget.framework",

View File

@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:UnityExport/Unity-iPhone.xcodeproj">
</FileRef>
<FileRef
location = "group:Runner.xcodeproj">
</FileRef>

View File

@ -7,6 +7,7 @@ import Flutter
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?
) -> Bool {
InitArgs(CommandLine.argc, CommandLine.unsafeArgv)
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}

View File

@ -39,6 +39,8 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>io.flutter.embedded_views_preview</key>
<true/>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>

View File

@ -1 +1,2 @@
#import "GeneratedPluginRegistrant.h"
#import "GeneratedPluginRegistrant.h"
#import "UnityUtils.h"

View File

@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter_unity_widget/flutter_unity_widget.dart';
void main() => runApp(MyApp());
@ -13,7 +12,7 @@ class _MyAppState extends State<MyApp> {
static final GlobalKey<ScaffoldState> _scaffoldKey =
GlobalKey<ScaffoldState>();
UnityWidgetController _unityWidgetController;
bool paused = false;
double _sliderValue = 0.0;
@override
void initState() {
@ -28,41 +27,65 @@ class _MyAppState extends State<MyApp> {
appBar: AppBar(
title: const Text('Unity Flutter Demo'),
),
body: Container(
child: Stack(
children: <Widget>[
UnityWidget(
onUnityViewCreated: onUnityCreated,
),
Positioned(
bottom: 40.0,
left: 80.0,
right: 80.0,
child: MaterialButton(
onPressed: () {
if(paused) {
_unityWidgetController.resume();
setState(() {
paused = false;
});
} else {
_unityWidgetController.pause();
setState(() {
paused = true;
});
}
},
color: Colors.blue[500],
child: Text(paused ? 'Start Game' : 'Pause Game'),
body: Card(
margin: const EdgeInsets.all(8),
clipBehavior: Clip.antiAlias,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20.0),
),
child: Stack(
children: <Widget>[
UnityWidget(
onUnityViewCreated: onUnityCreated,
isARScene: false,
onUnityMessage: onUnityMessage,
),
),
],
)),
Positioned(
bottom: 20,
left: 20,
right: 20,
child: Card(
elevation: 10,
child: Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.only(top: 20),
child: Text("Rotation speed:"),
),
Slider(
onChanged: (value) {
setState(() {
_sliderValue = value;
});
setRotationSpeed(value.toString());
},
value: _sliderValue,
min: 0,
max: 20,
),
],
),
),
),
],
),
),
),
);
}
void setRotationSpeed(String speed) {
_unityWidgetController.postMessage(
'Cube',
'SetRotationSpeed',
speed,
);
}
void onUnityMessage(controller, message) {
print('Received message from unity: ${message.toString()}');
}
// Callback that connects the created controller to the unity controller
void onUnityCreated(controller) {
this._unityWidgetController = controller;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -122,9 +122,41 @@ public static class XcodePostBuild
{
var inScope = false;
var markerDetected = false;
// Add static GetAppController
EditCodeFile(path, line =>
// Modify inline GetAppController
EditCodeFile(path, line =>
{
inScope |= line.Contains("include \"RenderPluginDelegate.h\"");
if (inScope && !markerDetected)
{
if (line.Trim() == "")
{
inScope = false;
markerDetected = true;
return new string[]
{
"",
"// Added by " + TouchedMarker,
"@protocol UnityEventListener <NSObject>",
"- (void)onMessage:(NSString *)message;",
"@end",
"",
};
}
return new string[] { line };
}
return new string[] { line };
});
inScope = false;
markerDetected = false;
// Add static GetAppController
EditCodeFile(path, line =>
{
inScope |= line.Contains("- (void)startUnity:");
@ -139,7 +171,9 @@ public static class XcodePostBuild
"",
"// Added by " + TouchedMarker,
"+ (UnityAppController*)GetAppController;",
""
"+ (void)addUnityEventListenerInternal:(id<UnityEventListener>)listener;",
"+ (void)removeUnityEventListenerInternal:(id<UnityEventListener>)listener;",
""
};
}
}
@ -166,10 +200,23 @@ public static class XcodePostBuild
{
"// }",
"",
"// Added by " + TouchedMarker,
"static inline UnityAppController* GetAppController()",
"{",
" return [UnityAppController GetAppController];",
"}",
"",
"// Added by " + TouchedMarker,
"static inline void addUnityEventListenerInternal(id<UnityEventListener> listener)",
"{",
" [UnityAppController addUnityEventListenerInternal: listener];",
"}",
"",
"// Added by " + TouchedMarker,
"static inline void removeUnityEventListenerInternal(id<UnityEventListener> listener)",
"{",
" [UnityAppController removeUnityEventListenerInternal:listener];",
"}"
};
}
@ -209,7 +256,26 @@ public static class XcodePostBuild
" return unityAppController;",
"}",
"",
line,
"// Added by " + TouchedMarker,
"static NSHashTable* mUnityEventListeners = [NSHashTable weakObjectsHashTable];",
"+ (void)addUnityEventListener2:(id<UnityEventListener>)listener",
"{",
" [mUnityEventListeners addObject: listener];",
"}",
"",
"// Added by " + TouchedMarker,
"+(void)removeUnityEventListener2:(id<UnityEventListener>)listener",
"{",
" [mUnityEventListeners removeObject: listener];",
"}",
line,
"// Added by " + TouchedMarker,
"extern \"C\" void onUnityMessage(const char* message)",
"{",
" for (id<UnityEventListener> listener in mUnityEventListeners) {",
" [listener onMessage:[NSString stringWithUTF8String:message]];",
" }",
"}",
};
}

View File

@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: 76f828f47ce26cc43991113c6a39dbbf
folderAsset: yes
timeCreated: 1466010535
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +1,8 @@
using System.Collections;
using System.Collections.Generic;
using System;
using UnityEngine;
using UnityEngine.EventSystems;
public class Rotate : MonoBehaviour
public class Rotate : MonoBehaviour, IEventSystemHandler
{
[SerializeField]
Vector3 RotateAmount;
@ -10,12 +10,35 @@ public class Rotate : MonoBehaviour
// Start is called before the first frame update
void Start()
{
RotateAmount = new Vector3(10, 10, 10);
RotateAmount = new Vector3(0, 0, 0);
}
// Update is called once per frame
void Update()
{
gameObject.transform.Rotate(RotateAmount * Time.deltaTime * 10);
for (int i = 0; i < Input.touchCount; ++i)
{
if (Input.GetTouch(i).phase.Equals(TouchPhase.Began))
{
var hit = new RaycastHit();
Ray ray = Camera.main.ScreenPointToRay(Input.GetTouch(i).position);
if (Physics.Raycast(ray, out hit))
{
// This method is used to send data to Flutter
UnityMessageManager.Instance.SendMessageToFlutter("The cube feels touched.");
}
}
}
}
// This method is called from Flutter
public void SetRotationSpeed(String message)
{
float value = float.Parse(message);
RotateAmount = new Vector3(value, value, value);
}
}

View File

@ -0,0 +1,26 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio for Mac
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp", "Assembly-CSharp.csproj", "{8454A3E8-CD6F-E229-B101-0AFF15D18447}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp-Editor", "Assembly-CSharp-Editor.csproj", "{FC6EB947-28DE-8385-8FAC-5C1621986B03}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8454A3E8-CD6F-E229-B101-0AFF15D18447}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8454A3E8-CD6F-E229-B101-0AFF15D18447}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8454A3E8-CD6F-E229-B101-0AFF15D18447}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8454A3E8-CD6F-E229-B101-0AFF15D18447}.Release|Any CPU.Build.0 = Release|Any CPU
{FC6EB947-28DE-8385-8FAC-5C1621986B03}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FC6EB947-28DE-8385-8FAC-5C1621986B03}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FC6EB947-28DE-8385-8FAC-5C1621986B03}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FC6EB947-28DE-8385-8FAC-5C1621986B03}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -1,12 +1,21 @@
{
"dependencies": {
"com.unity.2d.sprite": "1.0.0",
"com.unity.2d.tilemap": "1.0.0",
"com.unity.ads": "2.0.8",
"com.unity.analytics": "3.2.2",
"com.unity.collab-proxy": "1.2.15",
"com.unity.package-manager-ui": "2.0.7",
"com.unity.purchasing": "2.0.3",
"com.unity.textmeshpro": "1.3.0",
"com.unity.analytics": "3.3.2",
"com.unity.collab-proxy": "1.2.16",
"com.unity.ide.rider": "1.1.0",
"com.unity.ide.vscode": "1.1.2",
"com.unity.multiplayer-hlapi": "1.0.4",
"com.unity.purchasing": "2.0.6",
"com.unity.test-framework": "1.1.2",
"com.unity.textmeshpro": "2.0.1",
"com.unity.timeline": "1.2.2",
"com.unity.ugui": "1.0.0",
"com.unity.xr.legacyinputhelpers": "1.3.7",
"com.unity.modules.ai": "1.0.0",
"com.unity.modules.androidjni": "1.0.0",
"com.unity.modules.animation": "1.0.0",
"com.unity.modules.assetbundle": "1.0.0",
"com.unity.modules.audio": "1.0.0",

View File

@ -3,7 +3,7 @@
--- !u!30 &1
GraphicsSettings:
m_ObjectHideFlags: 0
serializedVersion: 12
serializedVersion: 13
m_Deferred:
m_Mode: 1
m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0}
@ -38,7 +38,7 @@ GraphicsSettings:
- {fileID: 10783, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 16002, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0}
m_PreloadedShaders: []
m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,
type: 0}
@ -63,3 +63,5 @@ GraphicsSettings:
m_AlbedoSwatchInfos: []
m_LightsUseLinearIntensity: 0
m_LightsUseColorTemperature: 0
m_LogWhenShaderIsCompiled: 0
m_AllowEnlightenSupportForUpgradedProject: 1

View File

@ -3,7 +3,7 @@
--- !u!129 &1
PlayerSettings:
m_ObjectHideFlags: 0
serializedVersion: 15
serializedVersion: 20
productGUID: e5da194b0a57a48cd8f1c3e35537f274
AndroidProfiler: 0
AndroidFilterTouchesWhenObscured: 0
@ -52,8 +52,7 @@ PlayerSettings:
m_StackTraceTypes: 010000000100000001000000010000000100000001000000
iosShowActivityIndicatorOnLoading: -1
androidShowActivityIndicatorOnLoading: -1
iosAppInBackgroundBehavior: 0
displayResolutionDialog: 1
iosUseCustomAppBackgroundBehavior: 0
iosAllowHTTPDownload: 1
allowedAutorotateToPortrait: 1
allowedAutorotateToPortraitUpsideDown: 1
@ -65,6 +64,7 @@ PlayerSettings:
disableDepthAndStencilBuffers: 0
androidStartInFullscreen: 1
androidRenderOutsideSafeArea: 0
androidUseSwappy: 0
androidBlitType: 0
defaultIsNativeResolution: 1
macRetinaSupport: 1
@ -79,11 +79,11 @@ PlayerSettings:
usePlayerLog: 1
bakeCollisionMeshes: 0
forceSingleInstance: 0
useFlipModelSwapchain: 1
resizableWindow: 0
useMacAppStoreValidation: 0
macAppStoreCategory: public.app-category.games
gpuSkinning: 1
graphicsJobs: 0
xboxPIXTextureCapture: 0
xboxEnableAvatar: 0
xboxEnableKinect: 0
@ -91,7 +91,6 @@ PlayerSettings:
xboxEnableFitness: 0
visibleInBackground: 1
allowFullscreenSwitch: 1
graphicsJobMode: 0
fullscreenMode: 1
xboxSpeechDB: 0
xboxEnableHeadOrientation: 0
@ -111,6 +110,7 @@ PlayerSettings:
switchNVNShaderPoolsGranularity: 33554432
switchNVNDefaultPoolsGranularity: 16777216
switchNVNOtherPoolsGranularity: 16777216
vulkanNumSwapchainBuffers: 2
vulkanEnableSetSRGBWrite: 0
m_SupportedAspectRatios:
4:3: 1
@ -125,7 +125,6 @@ PlayerSettings:
m_HolographicPauseOnTrackingLoss: 1
xboxOneDisableKinectGpuReservation: 1
xboxOneEnable7thCore: 1
isWsaHolographicRemotingEnabled: 0
vrSettings:
cardboard:
depthFormat: 0
@ -140,13 +139,23 @@ PlayerSettings:
hololens:
depthFormat: 1
depthBufferSharingEnabled: 1
lumin:
depthFormat: 0
frameTiming: 2
enableGLCache: 0
glCacheMaxBlobSize: 524288
glCacheMaxFileSize: 8388608
oculus:
sharedDepthBuffer: 1
dashSupport: 1
lowOverheadMode: 0
protectedContext: 0
v2Signing: 1
enable360StereoCapture: 0
protectGraphicsMemory: 0
isWsaHolographicRemotingEnabled: 0
enableFrameTimingStats: 0
useHDRDisplay: 0
D3DHDRBitDepth: 0
m_ColorGamuts: 00000000
targetPixelDensity: 30
resolutionScalingMode: 0
@ -156,7 +165,7 @@ PlayerSettings:
Android: com.YourCompanyName.YourProductName
buildNumber: {}
AndroidBundleVersionCode: 1
AndroidMinSdkVersion: 16
AndroidMinSdkVersion: 19
AndroidTargetSdkVersion: 0
AndroidPreferredInstallLocation: 1
aotOptions:
@ -171,10 +180,10 @@ PlayerSettings:
StripUnusedMeshComponents: 1
VertexChannelCompressionMask: 4054
iPhoneSdkVersion: 988
iOSTargetOSVersionString: 9.0
iOSTargetOSVersionString: 10.0
tvOSSdkVersion: 0
tvOSRequireExtendedGameController: 0
tvOSTargetOSVersionString: 9.0
tvOSTargetOSVersionString: 10.0
uIPrerenderedIcon: 0
uIRequiresPersistentWiFi: 0
uIRequiresFullScreen: 1
@ -193,6 +202,10 @@ PlayerSettings:
iPadHighResPortraitSplashScreen: {fileID: 0}
iPadLandscapeSplashScreen: {fileID: 0}
iPadHighResLandscapeSplashScreen: {fileID: 0}
iPhone65inPortraitSplashScreen: {fileID: 0}
iPhone65inLandscapeSplashScreen: {fileID: 0}
iPhone61inPortraitSplashScreen: {fileID: 0}
iPhone61inLandscapeSplashScreen: {fileID: 0}
appleTVSplashScreen: {fileID: 0}
appleTVSplashScreen2x: {fileID: 0}
tvOSSmallIconLayers: []
@ -244,7 +257,7 @@ PlayerSettings:
AndroidTargetArchitectures: 7
AndroidSplashScreenScale: 0
androidSplashScreen: {fileID: 0}
AndroidKeystoreName:
AndroidKeystoreName: '{inproject}: '
AndroidKeyaliasName:
AndroidBuildApkPerCpuArchitecture: 0
AndroidTVCompatibility: 1
@ -252,12 +265,14 @@ PlayerSettings:
AndroidEnableTango: 0
androidEnableBanner: 1
androidUseLowAccuracyLocation: 0
androidUseCustomKeystore: 0
m_AndroidBanners:
- width: 320
height: 180
banner: {fileID: 0}
androidGamepadSupportLevel: 0
resolutionDialogBanner: {fileID: 0}
AndroidValidateAppBundleSize: 1
AndroidAppBundleSizeToValidate: 150
m_BuildTargetIcons: []
m_BuildTargetPlatformIcons:
- m_BuildTarget: Android
@ -465,12 +480,44 @@ PlayerSettings:
- m_BuildTarget: WebGL
m_StaticBatching: 0
m_DynamicBatching: 0
m_BuildTargetGraphicsJobs:
- m_BuildTarget: MacStandaloneSupport
m_GraphicsJobs: 0
- m_BuildTarget: Switch
m_GraphicsJobs: 0
- m_BuildTarget: MetroSupport
m_GraphicsJobs: 0
- m_BuildTarget: AppleTVSupport
m_GraphicsJobs: 0
- m_BuildTarget: BJMSupport
m_GraphicsJobs: 0
- m_BuildTarget: LinuxStandaloneSupport
m_GraphicsJobs: 0
- m_BuildTarget: PS4Player
m_GraphicsJobs: 0
- m_BuildTarget: iOSSupport
m_GraphicsJobs: 0
- m_BuildTarget: WindowsStandaloneSupport
m_GraphicsJobs: 0
- m_BuildTarget: XboxOnePlayer
m_GraphicsJobs: 0
- m_BuildTarget: LuminSupport
m_GraphicsJobs: 0
- m_BuildTarget: AndroidPlayer
m_GraphicsJobs: 0
- m_BuildTarget: WebGLSupport
m_GraphicsJobs: 0
m_BuildTargetGraphicsJobMode:
- m_BuildTarget: PS4Player
m_GraphicsJobMode: 0
- m_BuildTarget: XboxOnePlayer
m_GraphicsJobMode: 0
m_BuildTargetGraphicsAPIs:
- m_BuildTarget: AndroidPlayer
m_APIs: 0b00000008000000
m_Automatic: 0
- m_BuildTarget: iOSSupport
m_APIs: 0b00000008000000
m_APIs: 10000000
m_Automatic: 0
- m_BuildTarget: AppleTVSupport
m_APIs: 10000000
@ -484,9 +531,10 @@ PlayerSettings:
m_Devices:
- Oculus
- OpenVR
m_BuildTargetEnableVuforiaSettings: []
openGLRequireES31: 0
openGLRequireES31AEP: 0
openGLRequireES32: 0
vuforiaEnabled: 0
m_TemplateCustomTags: {}
mobileMTRendering:
Android: 1
@ -670,6 +718,7 @@ PlayerSettings:
ps4DownloadDataSize: 0
ps4GarlicHeapSize: 2048
ps4ProGarlicHeapSize: 2560
playerPrefsMaxSize: 32768
ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ
ps4pnSessions: 1
ps4pnPresence: 1
@ -700,9 +749,11 @@ PlayerSettings:
ps4contentSearchFeaturesUsed: 0
ps4attribEyeToEyeDistanceSettingVR: 0
ps4IncludedModules: []
ps4attribVROutputEnabled: 0
monoEnv:
splashScreenBackgroundSourceLandscape: {fileID: 0}
splashScreenBackgroundSourcePortrait: {fileID: 0}
blurSplashScreenBackground: 1
spritePackerPolicy:
webGLMemorySize: 256
webGLExceptionSupport: 1
@ -717,6 +768,7 @@ PlayerSettings:
webGLCompressionFormat: 1
webGLLinkerTarget: 1
webGLThreadsSupport: 0
webGLWasmStreaming: 0
scriptingDefineSymbols: {}
platformArchitecture: {}
scriptingBackend:
@ -727,6 +779,8 @@ PlayerSettings:
allowUnsafeCode: 0
additionalIl2CppArgs:
scriptingRuntimeVersion: 1
gcIncremental: 0
gcWBarrierValidation: 0
apiCompatibilityLevelPerPlatform: {}
m_RenderingPath: 1
m_MobileRenderingPath: 1
@ -757,7 +811,6 @@ PlayerSettings:
metroFTAName:
metroFTAFileTypes: []
metroProtocolName:
metroCompilationOverrides: 1
XboxOneProductId:
XboxOneUpdateKey:
XboxOneSandboxId:
@ -782,7 +835,6 @@ PlayerSettings:
XboxOneAllowedProductIds: []
XboxOnePersistentLocalStorageSize: 0
XboxOneXTitleMemory: 8
xboxOneScriptCompiler: 1
XboxOneOverrideIdentityName:
vrEditorSettings:
daydream:
@ -796,18 +848,11 @@ PlayerSettings:
m_PortalFolderPath:
luminCert:
m_CertPath:
m_PrivateKeyPath:
m_SignPackage: 1
luminIsChannelApp: 0
luminVersion:
m_VersionCode: 1
m_VersionName:
facebookSdkVersion: 7.9.4
facebookAppId:
facebookCookies: 1
facebookLogging: 1
facebookStatus: 1
facebookXfbml: 0
facebookFrictionlessRequests: 1
apiCompatibilityLevel: 6
cloudProjectId: 8d747fa2-16cc-437c-9ae7-de9820958d80
framebufferDepthMemorylessMode: 0

View File

@ -1 +1,2 @@
m_EditorVersion: 2018.3.9f1
m_EditorVersion: 2019.3.0b7
m_EditorVersionWithRevision: 2019.3.0b7 (9946d7a66754)

View File

@ -0,0 +1,10 @@
{
"m_SettingKeys": [
"VR Device Disabled",
"VR Device User Alert"
],
"m_SettingValues": [
"False",
"False"
]
}

View File

@ -122,9 +122,41 @@ public static class XcodePostBuild
{
var inScope = false;
var markerDetected = false;
// Add static GetAppController
EditCodeFile(path, line =>
// Modify inline GetAppController
EditCodeFile(path, line =>
{
inScope |= line.Contains("include \"RenderPluginDelegate.h\"");
if (inScope && !markerDetected)
{
if (line.Trim() == "")
{
inScope = false;
markerDetected = true;
return new string[]
{
"",
"// Added by " + TouchedMarker,
"@protocol UnityEventListener <NSObject>",
"- (void)onMessage:(NSString *)message;",
"@end",
"",
};
}
return new string[] { line };
}
return new string[] { line };
});
inScope = false;
markerDetected = false;
// Add static GetAppController
EditCodeFile(path, line =>
{
inScope |= line.Contains("- (void)startUnity:");
@ -139,7 +171,9 @@ public static class XcodePostBuild
"",
"// Added by " + TouchedMarker,
"+ (UnityAppController*)GetAppController;",
""
"+ (void)addUnityEventListenerInternal:(id<UnityEventListener>)listener;",
"+ (void)removeUnityEventListenerInternal:(id<UnityEventListener>)listener;",
""
};
}
}
@ -166,10 +200,23 @@ public static class XcodePostBuild
{
"// }",
"",
"// Added by " + TouchedMarker,
"static inline UnityAppController* GetAppController()",
"{",
" return [UnityAppController GetAppController];",
"}",
"",
"// Added by " + TouchedMarker,
"static inline void addUnityEventListenerInternal(id<UnityEventListener> listener)",
"{",
" [UnityAppController addUnityEventListenerInternal: listener];",
"}",
"",
"// Added by " + TouchedMarker,
"static inline void removeUnityEventListenerInternal(id<UnityEventListener> listener)",
"{",
" [UnityAppController removeUnityEventListenerInternal:listener];",
"}"
};
}
@ -209,7 +256,26 @@ public static class XcodePostBuild
" return unityAppController;",
"}",
"",
line,
"// Added by " + TouchedMarker,
"static NSHashTable* mUnityEventListeners = [NSHashTable weakObjectsHashTable];",
"+ (void)addUnityEventListener2:(id<UnityEventListener>)listener",
"{",
" [mUnityEventListeners addObject: listener];",
"}",
"",
"// Added by " + TouchedMarker,
"+(void)removeUnityEventListener2:(id<UnityEventListener>)listener",
"{",
" [mUnityEventListeners removeObject: listener];",
"}",
line,
"// Added by " + TouchedMarker,
"extern \"C\" void onUnityMessage(const char* message)",
"{",
" for (id<UnityEventListener> listener in mUnityEventListeners) {",
" [listener onMessage:[NSString stringWithUTF8String:message]];",
" }",
"}",
};
}