2017-09-23 55 views
1

標題基本上就是這麼說的,我試圖運行一個非常基本的Unity遊戲,它使用Affectiva的情緒SDK for Unity來捕獲2種情緒。即使是低端的Android設備,該遊戲仍然流暢,但在iOS設備上並不那麼流暢(目前已在iPhone 6 - iOS 10,6s - iOS 11,7上測試過)。在遊戲場景中,我已將偵測器和相機輸入腳本附加到主攝像機,採樣率設置爲8,目標寬度爲320,目標高度爲240.但是無論遊戲運行的順利。只要我禁用這兩個腳本,遊戲就會在iOS上順利運行。任何改善遊戲性能的建議?在iOS設備上使用Affectiva插件時出現的混亂

回答

0

有一個未發佈的變化可以提高性能。能否請您試試這個變化,看看是否有幫助:

From 876c21d95eb84759742a4640f9fd30f4c6aa3518 Mon Sep 17 00:00:00 2001 
From: Forest Handford <[email protected]> 
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 
+1

嗨森林,這改善了我的遊戲有點雖然遊戲仍然沒有在iOS設備上幾乎一樣光滑的,因爲它是在Android設備上。感謝您的回覆,有沒有更多的建議可以提供給我?另外,您是否可以善意地告訴我所謂的技術是什麼,這些技術將同時對所有文件進行這些更改,必須以您提供的格式提供某種方式。只是稍微推動一下即將尋找的東西會很棒。謝謝:) –

+0

作爲salaam alaikum穆罕默德,這裏是一篇文章,談論應用差異: https://stackoverflow.com/questions/12320863/how-do-you-take-a-git-diff-file-and -apply-it-to-a-local-branch-that-a-copy-o 減少Affectiva插件CPU使用率的主要方法是降低幀速率和分辨率。你可以嘗試5而不是8,但我不會降低。我會問我的同事是否可以想到別的。感謝更新。我們需要儘快獲得這個補丁! –

+1

Walaikumasslam。我已經嘗試降低幀率,分辨率沒有太大的差別。我會盡力不斷優化遊戲。感謝SDK上的提示和應用差異的鏈接,它們總是一些新的東西:) –