在使用Affectiva的Unity插件时,iOS设备上的抖动

时间:2017-09-23 16:35:31

标签: ios iphone unity5 unity2d affdex-sdk

标题基本上说明了一切,我正在尝试运行一个非常基本的Unity游戏,它使用Affectiva的Unity情感SDK捕获2种情绪。即使是低端的Android设备,这款游戏仍然非常流畅,但在iOS设备上却不那么流畅(目前在iPhone 6上测试过 - iOS 10,6s - iOS 11,7)。我在我的游戏场景中将探测器和摄像机输入脚本附加到主摄像机,采样率设置为8,目标宽度为320,目标高度为240.但无论游戏运行不顺畅。一旦我禁用这两个脚本,游戏就会在iOS上顺利运行。有关提高游戏性能的建议吗?

1 个答案:

答案 0 :(得分:0)

未发布的更改可提高性能。你可以试试这个改变,看看它是否有帮助:

From 876c21d95eb84759742a4640f9fd30f4c6aa3518 Mon Sep 17 00:00:00 2001
From: Forest Handford <forest.handford@affectiva.com>
Date: Mon, 28 Aug 2017 13:21:17 +0200
Subject: [PATCH] SDK-1316: Sofia's performance changes

---
 .../Assets/Affdex/Plugins/Scripts/AndroidNativePlatform.cs       | 2 +-
 UnityPlugin/Assets/Affdex/Plugins/Scripts/Detector.cs            | 1 +
 UnityPlugin/Assets/Affdex/Plugins/Scripts/NativePlatform.cs      | 9 ++++++++-
 UnityPlugin/Assets/Affdex/Plugins/Scripts/OSXNativePlatform.cs   | 2 +-
 .../Assets/Affdex/Plugins/Scripts/WindowsNativePlatform.cs       | 2 +-
 UnityPlugin/Assets/Affdex/Plugins/Scripts/iOSNativePlatform.cs   | 2 +-
 6 files changed, 13 insertions(+), 5 deletions(-)
 mode change 100644 => 100755 UnityPlugin/Assets/Affdex/Plugins/Scripts/AndroidNativePlatform.cs
 mode change 100644 => 100755 UnityPlugin/Assets/Affdex/Plugins/Scripts/Detector.cs
 mode change 100644 => 100755 UnityPlugin/Assets/Affdex/Plugins/Scripts/NativePlatform.cs
 mode change 100644 => 100755 UnityPlugin/Assets/Affdex/Plugins/Scripts/OSXNativePlatform.cs
 mode change 100644 => 100755 UnityPlugin/Assets/Affdex/Plugins/Scripts/WindowsNativePlatform.cs
 mode change 100644 => 100755 UnityPlugin/Assets/Affdex/Plugins/Scripts/iOSNativePlatform.cs

diff --git a/UnityPlugin/Assets/Affdex/Plugins/Scripts/AndroidNativePlatform.cs b/UnityPlugin/Assets/Affdex/Plugins/Scripts/AndroidNativePlatform.cs
old mode 100644
new mode 100755
index 07e9af2..885dfce
--- a/UnityPlugin/Assets/Affdex/Plugins/Scripts/AndroidNativePlatform.cs
+++ b/UnityPlugin/Assets/Affdex/Plugins/Scripts/AndroidNativePlatform.cs
@@ -58,7 +58,7 @@ namespace Affdex

         public override IEnumerator Initialize (Detector detector, int discrete)
         {
-            AndroidNativePlatform.detector = detector;
+            this.detector = detector;

             // assemble the destination path where the data files will go
             affdexDataDir = Path.Combine(Application.persistentDataPath, "affdex-data");
diff --git a/UnityPlugin/Assets/Affdex/Plugins/Scripts/Detector.cs b/UnityPlugin/Assets/Affdex/Plugins/Scripts/Detector.cs
old mode 100644
new mode 100755
index f5f1645..f5b6a41
--- a/UnityPlugin/Assets/Affdex/Plugins/Scripts/Detector.cs
+++ b/UnityPlugin/Assets/Affdex/Plugins/Scripts/Detector.cs
@@ -53,6 +53,7 @@ namespace Affdex
             set
             {
                 listener = value;
+                Debug.Log("Detector listener set");
             }
         }

diff --git a/UnityPlugin/Assets/Affdex/Plugins/Scripts/NativePlatform.cs b/UnityPlugin/Assets/Affdex/Plugins/Scripts/NativePlatform.cs
old mode 100644
new mode 100755
index 610402f..0484f1c
--- a/UnityPlugin/Assets/Affdex/Plugins/Scripts/NativePlatform.cs
+++ b/UnityPlugin/Assets/Affdex/Plugins/Scripts/NativePlatform.cs
@@ -34,9 +34,16 @@ namespace Affdex
         }
     }

+   /// internal static class DetectorHelper: Detector
+  ///  {
+        ///code to be inserted here when I figure it out, something about a public void
+        ///
+
+   /// }
+
     public abstract class NativePlatform : MonoBehaviour
     {
-        protected static Detector detector;
+        protected Detector detector;

         //Free these when platform closes!
         protected GCHandle h1, h2, h3; //handles to unmanaged function pointer callbacks
diff --git a/UnityPlugin/Assets/Affdex/Plugins/Scripts/OSXNativePlatform.cs b/UnityPlugin/Assets/Affdex/Plugins/Scripts/OSXNativePlatform.cs
old mode 100644
new mode 100755
index 299dbd1..5e72c44
--- a/UnityPlugin/Assets/Affdex/Plugins/Scripts/OSXNativePlatform.cs
+++ b/UnityPlugin/Assets/Affdex/Plugins/Scripts/OSXNativePlatform.cs
@@ -56,7 +56,7 @@ namespace Affdex

         public override IEnumerator Initialize(Detector detector, int discrete)
         {
-            OSXNativePlatform.detector = detector;
+            this.detector = detector;
             String adP = Application.streamingAssetsPath;
             String affdexDataPath = Path.Combine(adP, "affdex-data-osx"); 
             int status = 0;
diff --git a/UnityPlugin/Assets/Affdex/Plugins/Scripts/WindowsNativePlatform.cs b/UnityPlugin/Assets/Affdex/Plugins/Scripts/WindowsNativePlatform.cs
old mode 100644
new mode 100755
index 47681df..f91f319
--- a/UnityPlugin/Assets/Affdex/Plugins/Scripts/WindowsNativePlatform.cs
+++ b/UnityPlugin/Assets/Affdex/Plugins/Scripts/WindowsNativePlatform.cs
@@ -57,7 +57,7 @@ namespace Affdex

         public override IEnumerator Initialize(Detector detector, int discrete)
         {
-            WindowsNativePlatform.detector = detector;
+            this.detector = detector;

             //load our lib!
             string affdexDataPath = Application.streamingAssetsPath + "/affdex-data-3";
diff --git a/UnityPlugin/Assets/Affdex/Plugins/Scripts/iOSNativePlatform.cs b/UnityPlugin/Assets/Affdex/Plugins/Scripts/iOSNativePlatform.cs
old mode 100644
new mode 100755
index 8a61512..d37a631
--- a/UnityPlugin/Assets/Affdex/Plugins/Scripts/iOSNativePlatform.cs
+++ b/UnityPlugin/Assets/Affdex/Plugins/Scripts/iOSNativePlatform.cs
@@ -88,7 +88,7 @@ namespace Affdex

         public override IEnumerator Initialize(Detector detector, int discrete)
         {
-            iOSNativePlatform.detector = detector;
+            this.detector = detector;
             String adP = Application.streamingAssetsPath;
             String affdexDataPath = Path.Combine(adP, "affdex-data-osx");

-- 
2.7.4.1.g5468f9e