使用 Affectiva 的 Unity 插件时 iOS 设备出现抖动

Jerkiness on iOS devices while using Affectiva's plugin for Unity

标题基本上说明了一切,我正在尝试 运行 一个非常基本的 Unity 游戏,它使用 Affectiva 的 Unity 情感 SDK 捕捉 2 种情感。该游戏甚至在低端 Android 设备上都非常流畅,但在 iOS 设备上就不是那么流畅了(目前在 iPhone 6 - iOS 10、6s - [=14 上测试=] 11, 7).我在我的游戏场景中将检测器和相机输入脚本附加到主相机,采样率设置为 8,目标宽度为 320,目标高度为 240。但无论怎样游戏都不 运行 流畅。一旦我禁用这 2 个脚本,游戏就会在 iOS 上顺利地 运行 开始。有什么改进游戏性能的建议吗?

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

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