Tag Archives: Unity

Unit Android converts c# class to JSON file and reports an error

Original file connection: unity about the error report of newtonsoft. JSON reference!!!! (resolved)_ Xiaoyan can’t write code blog – CSDN blog

I’m afraid the original article will be deleted once.

1、 Download the newtonsoft.json.dll library

https://www.nuget.org/packages/Newtonsoft.Json/

After downloading, change the downloaded file to a. Zip file and unzip it. After decompression, find the newtonsoft.json.dll file in the directory:… \ newtonsoft. JSON. 13.0.1 \ lib \ netstandard2.0 and copy it to the… \ assets \ plugins \ netstandard2.0 directory of unity.

2、 Modify unit settings

ProjectSetting-> Player-> API compatibility level changed to. Net 4. X

Create a new link.xml file in the assets directory of the unity project:

<linker>
	<assembly fullname="System.Core">
		<type fullname="System.Linq.Expressions.Interpreter.LightLambda" preserve="all" />
	</assembly>
</linker>

Unity Error:InvalidCastException: Cannot cast from source type to destination type.

Error:
when I use system.data.dll to parse excel table; Encountered this error:

wrong positioning:
this is an excel problem; The error is reported in: excel reader. Asdataset() is due to the problem of Excel format;

Solution:
you can solve this problem by setting the cell format as text in Excel table;

Reference website:
Yusong Momo cross platform analysis Excel

The error problem of loading autoware maptool function package by utiny is solved

The error problem of loading autoware maptool function package by utiny is solved

Cannot perform upm operation: connect ETIMEDOUT 172.81.232.209:443 [NotFound]
UnityEditor.EditorApplication:Internal_ CallUpdateFunctions ()

After referring to many online tutorials, I tried to modify DNS, delete Josn files for many times, and even downloaded different versions of unity. I tried all afternoon
finally, I thought that since it was a network problem, I referred to the method of ROS installation
connected to the mobile hotspot, and it was OK

error CS0234: The type or namespace name ‘UI‘ does not exist in the namespace ‘UnityEngine‘

1. After opening the project, an error is reported: error cs0234: the type or namespace name ‘UI’ doors not exist in the namespace ‘unityengine’

2. Solution: close untiy, delete the Library folder, and then reopen the project

[1] Close the project and delete the folder library. The location is as follows:

[2] . reopen the project and unity will automatically rebuild the relevant DLL

[Solved] Unity package Error: CommandInvokationFailure: Gradle build failed.

CommandInvokationFailure: Gradle build failed.
F:/Program Files/Unity/2017.4.31f/Editor/Data/PlaybackEngines/AndroidPlayer/Tools\OpenJDK\Windows\bin\java.exe -classpath “F:\Program Files\Unity\2017.4.31f\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-4.6.0.jar” org.gradle.launcher.GradleMain “-Dorg.gradle.jvmargs=-Xmx4096m” “assembleRelease”

 

Solution:

if there is where in the error message: followed by garbled characters, it means that the path is wrong, and neither the project nor the signature can be in English.

Unity report error CS0619: ‘XRDevice.isPresent’ is obsolete

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;
    }
}

[Solved] Unity Error: ‘BuildPipeline‘ does not contain a definition for ‘GetBuildTargetName‘

@[TOC] (error: Library \ packagecache \ com. Unity. XR [email protected] \Editor\XRGeneralBuildProcessor.cs(83,52): error CS0117: ‘BuildPipeline’ does not contain a definition for ‘GetBuildTargetName’)

Problem Description:

when unity develops oculus quest, it will report an error library \ packagecache \ com.unity.xr [email protected] \Editor \ xrgeneralbuildprocessor.cs (83,52): error cs0117: ‘buildpipeline’ doors not contain a definition for ‘getbuildtargetname’
my unit version is 2019.4


Cause analysis:

the version of the plug-in matches the version of the unity step, resulting in </ font>


Solution:

delete ar foundation, downgrade XR plug-in management to 3.2.16, downgrade ar foundation and arkit XR plug-ins to 4.1.1, and reinstall ar foundation
record the pit encountered and it has been solved

[Solved] Unity Package Error: FAILURE: Build failed with an exception.

Main error reports:

> Using multiple versions of the Android gradle plugin in the sample build is not allowed.
meaning: using multiple versions of the Android gradle plugin in the same version is not allowed.

positioning:
gradle version problem in
unit

Solution:
there is a gradle version file in the project
launchertemplate
maintemplate
find a code similar to the following

buildscript {
    repositories {
        mavenCentral()
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.3'
**BUILD_SCRIPT_DEPS**}

If not, add
as shown in the figure

to ensure that the version numbers (3.4.3) in the two files are consistent

The mapboxsdk imports the higher version unity2020 and 2021 and reports an error arbackgroundrenderer

The mapboxsdk imports the higher version unity2020 and 2021 and reports an error arbackgroundrenderer

Using unity above 2020 will result in an error: solution:

Using unity above 2020 will result in an error:

Solution:

Only check mapbox when importing the installation package. The main reason is that unity changed the name and function of the arbackgroundrenderer class in version 2020, and mapbox did not update its SDK, resulting in the inability to use the AR function

Android studio reports an error when building AAR for unity

CommandInvokationFailure: Gradle build failed. 
C:\Program Files\Java\jdk1.8.0_191\bin\java.exe -classpath "C:\Program Files\Unity Hub\Unity\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-5.6.4.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleDebug"

stderr[

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':launcher:checkDebugDuplicateClasses'.
> 1 exception was raised by workers:
  java.lang.RuntimeException: Duplicate class bitter.jnibridge.JNIBridge found in modules opsdk-debug-runtime.jar (:opsdk-debug:) and unity-classes.jar (unity-classes.jar)
  Duplicate class bitter.jnibridge.JNIBridge$a found in modules opsdk-debug-runtime.jar (:opsdk-debug:) and unity-classes.jar (unity-classes.jar)
  Duplicate class com.unity3d.player.GoogleARCoreApi found in modules opsdk-debug-runtime.jar (:opsdk-debug:) and unity-classes.jar (unity-classes.jar)