Hololens项目,Unity从5.6更新到2017,Vuforia从6.2更新到6.5

  之前项目组希望以后项目都用Unity2017来做,当然免不了更新之前版本的一些组件,其中有一个组件用到了Vuforia,更新就按照Vuforia的官网教程(

https://library.vuforia.com/articles/Solution/migrate-vuforia-62-to-65.html

)来更新,配置按照之前项目的配置走,顺利完成。但是交付给同事之后,同事的需求是希望重新载入、跳转到含有Vuforia的这个场景,结果就报了个神奇的错误,大概看下来应该是重新开启Vuforia的时候封装的内部回调出错。

Exception in callback: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> UnityEngine.MissingReferenceException: The object of type 'Camera' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
  at (wrapper managed-to-native) UnityEngine.Camera:get_nearClipPlane ()
  at Vuforia.DedicatedEyewearCameraConfiguration.UpdateProjection () [0x00000] in :0 
  at Vuforia.DedicatedEyewearCameraConfiguration.ConfigureVideoBackground () [0x00000] in :0 
  at Vuforia.DedicatedEyewearCameraConfiguration.CheckForSurfaceChanges (UnityEngine.ScreenOrientation& orientation) [0x00000] in :0 
  at Vuforia.VuforiaARController.UpdateStatePrivate (Boolean forceUpdate, Boolean reapplyOldState) [0x00000] in :0 
  at Vuforia.VuforiaARController.UpdateState (Boolean forceUpdate, Boolean reapplyOldState) [0x00000] in :0 
  at Vuforia.DigitalEyewearARController.Update () [0x00000] in :0 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x000d0] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222 
  --- End of inner exception stack trace ---
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x000eb] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232 
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115 
  at System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x000b9] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Delegate.cs:443 
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x00018] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/MulticastDelegate.cs:71 
  at System.Delegate.DynamicInvoke (System.Object[] args) [0x00000] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Delegate.cs:415 
  at Vuforia.DelegateHelper.InvokeDelegate (System.Delegate action, System.Object[] args) [0x00000] in :0 
UnityEngine.Debug:LogError(Object)
Vuforia.DelegateHelper:InvokeDelegate(Delegate, Object[])
Vuforia.DelegateHelper:InvokeWithExceptionHandling(Action)
Vuforia.VuforiaBehaviour:Update()


经过一番排查,发现问题

ARCamera上的配置中,有一个Digital Eyewear,选项下Eyewear Type如果选择None,就不会出现这个问题

但是在hololens下开发,必须选择Opeical See-Through,Hololens。不然在Hololens下会闪退。

暂时还没有什么好的解决方案,只能说Vufooria在2017下还有问题,修复之前尽量别升级。



你可能感兴趣的:(Hololens开发)