Unity error resolution error cs0619: ‘xrdevice. Ispresent’ is obsolete:
1. Problem description 2. Solution
1. Problem description
Assets\Battlehub\RTCommon\Scripts\RTEBase.cs(690,20): error CS0619: ‘XRDevice.isPresent’ is obsolete: ‘This is obsolete, and should no longer be used. Instead, find the active XRDisplaySubsystem and check that the running property is true (for details, see XRDevice.isPresent documentation).’
This error occurred when I was using unity’s runtimes editor plug-in, which probably means that the API has expired and needs to be modified.
2. Solutions
I checked the Internet and found no relevant information, so I went directly to unity’s API document according to the error message. After looking at it, I know that the previous interface can’t be used. Just rewrite it. Xrdevice.ispresent document. Just rewrite an inner class and call it again according to the document
add the following part to the code, and then modify the calling code.
internal static class ExampleUtil
{
public static bool isPresent()
{
var xrDisplaySubsystems = new List<XRDisplaySubsystem>();
SubsystemManager.GetInstances<XRDisplaySubsystem>(xrDisplaySubsystems);
foreach (var xrDisplay in xrDisplaySubsystems)
{
if (xrDisplay.running)
{
return true;
}
}
return false;
}
}
Read More:
- Unity reports an error cs0619: ‘guitexture’ is obsolete
- The build report plug-in reported an error in importing unit script (BRT_ Util.cs :error CS1525: Unexpected symbol `;’, expecting `)’, or `,’)
- Unity2019.1.02f error cs0104: ‘minattribute’ is an ambiguous reference between
- Unity development memo 000025: error cs0433: the type ‘task’ exists in both ‘xxx’ and ‘YYY’
- [Fixed] Unity error CS1704: An assembly with the same name `UnityEngine.UI’ has already been imported
- Unity WebGL error CS0117: ‘NetworkTransport’ does not contain a definition for ‘SetMulticastLock’
- Error cs1010 cs8025 cs1012 cs1525 common document error resolution
- Notes on unity project_ Unity webplayer failed to update unity web player
- Unity3D error CS0227: Unsafe code may only appear if compiling with /unsafe…
- What is cs0120 error
- What is cs1525 error
- Error report set of unity: failed to unload “assets / animation / clips / run_ 5.anim”
- Unity package encountered an error report about gradle build failed
- Unity install ilruntime plug-in [novice installation tutorial] (supported by unity2018 and later versions)
- Unity “Feature `out variable declaration’ cannot be used because it is not part of the C# 4.0” error
- 【Unity 3D】Because you are not a member of this project this build will not access Unity services.
- Unity3d open prompt failed to initialize unity graphic
- Unity-failed to update unity web player
- [unity] when using unity hub, there is a problem of “failed to delete old unit installation file…” problem
- After unity connects with androidstudio, unity packages APK with an error: commandinvocationfailure: failed to re package resources