这些错误会使您的AR Foundation应用显示为黑屏
Posted weixin_26737625
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了这些错误会使您的AR Foundation应用显示为黑屏相关的知识,希望对你有一定的参考价值。
In recent years, AR technology has developed rapidly. Following the release of the amazing ARKit 3 last year, this year Apple released ARKit 4 on WWDC 2020. And Unity also has expanded its AR Foundation to add these new features from ARKit 3.5 and ARKit 4 quickly. With the development of AR technology, more and more developers use Unity’s AR Foundation to develop AR applications running on different platforms.
近年来 ,AR技术发展很快。 继去年发布了令人惊叹的ARKit 3之后,今年苹果在WWDC 2020上发布了ARKit4。Unity还扩展了其AR Foundation,以快速添加ARKit 3.5和ARKit 4的这些新功能。 随着AR技术的发展,越来越多的开发人员使用Unity的AR Foundation开发运行在不同平台上的AR应用程序。
However, as a developer using Unity’s AR Foundation, there are some mistakes that may make you feel bad when developing an AR app. This post will detail 4 common mistakes that cause the AR application to display a black screen on your phone.
但是,作为使用Unity的AR Foundation的开发人员,存在一些错误,可能使您在开发AR应用程序时感到不舒服。 这篇文章将详细介绍导致AR应用程序在手机上显示黑屏的4个常见错误。
错误1:您没有为特定平台安装平台软件包 (Mistake #1 You Didn't Install The Platform Package For The Specific Platform)
I think it’s the most common mistake that AR developers may encounter when using AR Foundation in Unity to develop AR apps. As you can see from the architecture of the AR solution in Unity above, you will find that AR Foundation is just an abstract layer for developers to develop their AR App in Unity using C# programming language.
我认为这是AR开发人员在Unity中使用AR Foundation开发AR应用程序时可能遇到的最常见错误。 从上面Unity中的AR解决方案的体系结构可以看出,AR Foundation只是开发人员使用C#编程语言在Unity中开发其AR App的抽象层。
If you only install the AR Foundation package via the Unity package manager, it won't install the platform package required on a specific platform automatically for you. And you have to install it/them manually.
如果仅通过Unity软件包管理器安装AR Foundation软件包,则不会自动为您安装特定平台上所需的平台软件包。 而且您必须手动安装它。
For example, if you want to create an AR app on the iOS platform, then you need to install the ARKit XR Plugin.
例如,如果要在iOS平台上创建AR应用程序,则需要安装ARKit XR插件 。
错误2设备不支持AR功能 (Mistake #2 The Device Doesn’t Support The AR Function)
It is similar to the first mistake, but it is easily ignored by developers, which is the capabilities of the device itself.
它与第一个错误类似,但是开发人员很容易忽略它,这是设备本身的功能。
Let’s look at the architecture of the AR Foundation again. Yes, there is a lower level than Unity’s platform package, which is the SDK layer, provided by the devices.
让我们再次看一下AR Foundation的体系结构。 是的,比设备提供的Unity平台程序包(SDK层)低一层。
This mistake is more common on android devices than ios devices, for example, the Android phones that cannot install Google’s AR Core SDK, or the Android OS version of the device does not meet the requirements of AR Core SDK.
此错误在Android设备上比iOS设备更常见,例如,无法安装Google的AR Core SDK的Android手机,或者该设备的Android OS版本不符合AR Core SDK的要求。
错误#3通用渲染管道设置不正确 (Mistake #3 The Universal Render Pipeline Is Not Set Up Correctly)
If you want to use the Universal Render Pipeline instead of the built-in render pipeline in Unity, then you need to update your AR Foundation package and the corresponding ARKit XR Plugin package to 3.0.0 or later because the default verified version of AR Foundation package on Unity 2019.x is 2.x.x.
如果要使用通用渲染管道而不是Unity中的内置渲染管道,则需要将AR Foundation软件包和相应的ARKit XR插件软件包更新为3.0.0或更高版本,因为AR Foundation的默认验证版本Unity 2019.x上的软件包是2.xx
Next, you install the Universal RP package and set the UniversalRenderPipelineAsset to the Graphic setting of your project to replace the built-in render pipeline. Build your AR app to run on your iPhone, then you will see a black screen.
接下来,安装Universal RP软件包,并将UniversalRenderPipelineAsset设置为项目的Graphic设置,以替换内置的渲染管道。 构建您的AR应用程序以在iPhone上运行,然后您将看到黑屏。
In addition to upgrading your AR Foundation version, you also need to set the Universal Render Pipeline correctly to successfully replace the built-in rendering pipeline. For the AR app, we need to add the AR Background Renderer feature to the URP renderer. You can see the gif below.
除了升级您的AR Foundation版本,您还需要正确设置Universal Render Pipeline,以成功替换内置的渲染管道。 对于AR应用,我们需要将AR背景渲染器功能添加到URP渲染器。 您可以在下面看到gif。
错误4更新到AR Foundation 4.0.x,并且未正确设置 (Mistake #4 Update To AR Foundation 4.0.x And Did Not Set Up Correctly)
Presumably, you have corrected all the mistakes above , and you may encounter a fourth mistake that causes a black screen.
据推测,您已纠正了上述所有错误,并且可能遇到第四个错误,导致黑屏。
Now, let’s update the AR Foundation package and the corresponding platform package (ARKit XR plugin) to 4.0.2, and keep all other settings as before. Build the app and run it on your iPhone, and you will get another black screen with the following error message.
现在,让我们将AR Foundation软件包和相应的平台软件包(ARKit XR插件)更新为4.0.2,并保留所有其他设置。 生成该应用程序并在iPhone上运行,您将得到另一个黑屏,并显示以下错误消息。
It’s not hard to fix this error, you just need to check the Plugin-providers in the XR Plug-in Management panel. But you don't have to do it before AR Foundation 4.x.
修复此错误并不难,您只需要检查“ XR插件管理”面板中的插件提供程序即可。 但是您不必在AR Foundation 4.x之前就这样做。
Now your app should run as expected.
现在,您的应用程序应该可以按预期运行。
Thanks for reading and hope it’s helpful.
感谢您的阅读,希望对您有所帮助。
Have a chat at https://www.linkedin.com/in/chenjd/
以上是关于这些错误会使您的AR Foundation应用显示为黑屏的主要内容,如果未能解决你的问题,请参考以下文章
如何使用 XAMPP & ROUTER 使您的网站在线? (已经尝试了这些步骤,但结果是..)