Tag Archives: Unity

Avpro Video Error: MediaPlayer.FileLocation [How to Solve]

Problems with avpro video

Problem Description:

Mediaplayer.filelocation in version 2. X is red: it is inaccessible because it has a certain protection level

Solution:

Mediaplayer.filelocation encountered is inaccessible because it has a certain protection level
Press and hold Ctrl and click filelocation

just change private to public

Unity Android solves the problem of information flow advertisement closing and error reporting

This error often occurs when unity connects to some native andorid SDKs:

W/system. Err: Android. View. Viewrootimpl $calledfromwrongthreadexception: only the original thread that created a view hierarchy can touch its views.
the solution is to use runonuithread() in the java file written by the Android layer

The reason is that the UI update of Android needs to be in the main UI thread, and some callbacks of the advertising SDK are not in this thread

reference material:

https://www.jianshu.com/p/866743c0356b

https://blog.csdn.net/cf8833/article/details/90297775

Solve the error of Chinese file uploaded by springboot

Springboot version: 2.3.0.release

Front end use   File upload with unityengine.wwwform

Service error:

org.springframework.web.multipart.MultipartException: Failed to parse multipart servlet request; nested exception is java.lang.NoClassDefFoundError: javax/mail/internet/MimeUtility

Positioning questions:

POM file import dependency

        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
            <version>1.4.7</version>
        </dependency>

Re run and solve the problem (* ^ ▽ ^ *)~~

[Solved] Unity Error: Visual Studio Editor Package version 2.0.11 is available……..

Error: Visual Studio editor package version 2.0.11 is available, we strongly encode you to update from the unity package manager for a better visual studio integration

The details are shown in the following figure:
the reason for this problem is that the package in the package manager is not updated. We find the package manager in the window, observe where there is no green check, and then click in to update it.

There is a problem with newtonsoft.json.dll after adding plastic SCM

There is a problem with newtonsoft.json.dll after adding plastic SCM

A while ago, I opened a new personal project. Because it is a new project, I use the latest ones for everything I want. Therefore, I used plastic SCM officially launched by unity for version control
the plug-in was installed at the beginning. There was nothing wrong with it and it was OK to use. But as the project code piles up, well, the problem arises.

Because I use the powerful newtonsoft. JSON library. After it was added to the project, there was nothing wrong with using it a few days ago and it can be used normally. However, when I used this library in the code of the editor, I referenced the newtonsoft.json namespace and found that the problem came out. Unity kept reporting errors:

There are two in the project newtonsoft.json. This baffled me. After positioning, I found that there is also a newtonsoft.json Library in the plastic SCM package:

good heavens! You also changed someone’s name, # ¥% @# ¥, at least you also changed the namespace… You have a big surprise! Well, I’ll admit it. Who told me to use your stuff

Since you are determined to use it, I’ll think about how to solve it. Because I had no problem in the non editor code before, it may be that the JSON Library in the SCM package itself only runs in the editor mode, and some of the editor codes we wrote refer to the library in the SCM package… Speechless

My current solution:

Option 1:

Delete the original library and copy the in plastic SCM to the project to keep the versions of the two DLLs consistent:

1. Delete the JSON library referenced by ourselves in the project

2. Right click to find the physical path of the JSON Library in plastic SCM:

3. Find it and copy it to the plugins directory of our project, and modify its name as newtonsoft.json.dll

4. Then enter the project and wait for the compilation to be completed

Option 2:

Do not delete the JSON library you put into the project, and keep it coexisting with plastic SCM. However, there are requirements for the storage location of the physical path of the code file because. Asmdef is used.

1. Sort out the code of our editor and create an asmdef file (assembly definition file) in the relative root directory of the code:

For example, in my project, I was working on a level editor, so I sorted the code of the level editor into a levelmaker/scripts directory, and then right-click in the levelmaker directory to create asmdef:

As for sorting the code, if you do well in directory planning in the early stage, there should be no problem. As for how much code an asmdef file contains, it depends on the situation of the project. Some projects are more fine-grained. As for the code of the editor, I generally like to divide it by each tool.

2. After creating the. Asmdef file, unity will enclose our editor code and finally compile it into an independent DLL. Check the override reference option in the setting of. Asmdef, and the assembly references setting item will appear:

3. Add a reference to the dot product + sign, select the DLL file we need to specify the reference, and wait for compilation after applying

4. Finally, don’t forget to check the platform option in the settings, otherwise there will be problems in compiling when publishing

Option 3:

This method is not recommended because I haven’t used it. Just think of

Copy the plastic SCM separately, which is not maintained by packagesmanager, and put it in the plugins directory, so we can do whatever we want… For example, replace the JSON library it refers to with our own… Well, this sounds a bit like scheme 1… In fact, unity has also modified the JSON library it refers to

I don’t recommend it. After all, packagesmanager maintenance is very good, and any version iteration can be updated as soon as possible… After all, plastic SCM is just a tool

Option 4:

Find the source code of the JSON library, and compile your own JSON library after modification… Um…
newtonsoft. JSON library source code: https://github.com/JamesNK/Newtonsoft.Json

[unity] [fairygui] [ilruntime] Hot update error prompt add automatic code glist.itemextender problem

Glist.itemextender is used in the hot update ilruntime, and the unity editor will run with an error

KeyNotFoundException: Cannot find convertor for FairyGUI.ListItemProvider

Add the following code to the void registdelegate() function of ilruntimewrapper. CS in the unity project

appdomain.DelegateManager.RegisterDelegateConvertor<FairyGUI.ListItemProvider>((act) =>
{
    return new FairyGUI.ListItemProvider((index) =>
    {
        return ((Func<System.Int32, System.String>)act)(index);
    });
});

Unity editor running error, error prompt

KeyNotFoundException: Cannot find Delegate Adapter for:uicreatetroops.GetListItemResource(Int32 index), Please add following code:
appdomain.DelegateManager.RegisterFunctionDelegate<System.Int32, System.String>();

  Add the following code to the void registdelegate() function of ilruntimewrapper. CS in the unity project

appdomain.DelegateManager.RegisterFunctionDelegate<System.Int32, System.String>();

Make sure it is

Add the following code to the void registdelegate() function of ilruntimewrapper. CS in the unity project

...
void RegistDelegate()
{
...
        appdomain.DelegateManager.RegisterDelegateConvertor<FairyGUI.ListItemProvider>((act) =>
        {
            return new FairyGUI.ListItemProvider((index) =>
            {
                return ((System.Func<System.Int32, System.String>)act)(index);
            });
        });
        
        appdomain.DelegateManager.RegisterFunctionDelegate<System.Int32, System.String>();
...
}
...

Hot update ilruntime automatic error generation code…

Unitypackage failed to install or the express solution could not be installed

Cause of the problem:

The unitypackage is updated in the project, and it is stuck in the unitypackage manager interface after the update. As shown in the figure:

At this stage, the package is being updated, but for some reasons, it cannot be downloaded or failed to download.

The reason why the download failed or could not be downloaded has not been found, and the reason is unknown( It’s a matter of time

Solution:

Download the package to be updated locally by offline download or copy, and put it in the package cache directory of unity.

The directory path is as follows:

C:\Users\Administrator\AppData\Local\Unity\cache\packages\packages.unity.com

Then restart unity.

Principle:

The package downloaded by unity will be cached in the directory above. When the directory exists, the package under the directory will be copied to the project.

If there is no specified directory in the package directory, it will be downloaded.

In other words, if you put the package directly into the project, it will be invalid.

Asset database transaction committed tweet appears when unity reports an error!

Why does asset database transaction committed tweet appear in unity
Assertion failed on expression: ‘m_ ErrorCode == MDB_ MAP_ RESIZED || ! HasAbortingErrors()’

Solution:
save the file, re open the unity or activate the license, you can get the solution
cause: error caused by resource loss, or license expiration.

The error of is shown in the figure

Unity2019.1.02f error cs0104: ‘minattribute’ is an ambiguous reference between

Error importing information downloaded from resource store: postprocessing/Editor/propertydrawers\ MinDrawer.cs (6,34):error CS0104: ‘MinAttribute’ is an ambiguous reference between ‘ UnityEngine.PostProcessing.MinAttribute ‘ and ‘ UnityEngine.MinAttribute ‘。

The solution: to MinDrawer.cs Replace all minattributes in with UnityEngine.PostProcessing.MinAttribute .