소스 검색

error catch

lvjincheng 3 년 전
부모
커밋
acc6813fd7
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      Assets/BowArrow/Scripts/Bluetooth/AimHandler.cs

+ 4 - 1
Assets/BowArrow/Scripts/Bluetooth/AimHandler.cs

@@ -379,7 +379,10 @@ public class AimHandler : MonoBehaviour
            
         // }
         mag0o = UnityVectorTo0o(Mag);
-        if (!MagCalibrater.Update(mag0o)) {
+        try {
+            if (!MagCalibrater.Update(mag0o)) return;
+        } catch(System.Exception) {
+            MagCalibrater = new MagnetometerAutoCalibrater();
             return;
         }
         mag0o = MagCalibrater.EllipsoidFitting.Map(mag0o);