hololens2相机问题之The operating system has dropped the camera device used by Vuforia Engine
出现了一个问题,该程序在电脑unity端运行正常。在hololens2实机端进入关卡以后,AI功能正常,但是vuforia图像识别功能会崩溃,无法实现图像识别功能。Unity后台报错:Vuforia Engine has stopped due to an error: The operating ……
隐者艾伦的技术博客
Assets\SampleResources\Scripts\UnityMainThreadDispatcher.cs(34,25): warning CS0618: 'Object.FindObjectOfType<T>()' is obsolete: 'Object.FindObjectOfType has been deprecated. Use Object.FindFirstObjectByType instead or if finding any instance is acceptable the faster Object.FindAnyObjectByType'
导致该问题的原因:unity版本更新
这个警告 CS0618 表明你代码中使用的 Object.FindObjectOfType<T>()方法已经被 Unity 标记为过时(Obsolete)。自 Unity 2023.1 版本起,此方法以及 FindObjectsOfType开始被弃用,并计划在未来的版本中移除。而Unity 官方推荐使用新的方法来替代,主要原因在于性能优化。
旧的 FindObjectOfType方法在返回结果前会默认按物体的 InstanceID 进行排序,而这个排序操作消耗了该方法绝大部分的执行时间(在一些测试中甚至超过90%),但在大多数情况下这种排序并非必要。