Tag Archives: Unity

[Solved] Unity Error: Assertion failed on expression: ‘IsMatrixValid(matrix)‘…

Problem description:

I get an error when running the Interaction_Example of steam VR, and the running screen is a black screen, where unity is 2021.3.6f1c1, steam VR(2.7.3), steamvrSDK( 1.23.7), The headset is HTC Vive pro2. The specific content of the error is as follows:

Assertion failed on expression: 'IsMatrixValid(matrix)'
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

Screen position out of view frustum (screen pos 0.000000, 0.000000, 300.000000) (Camera rect 0 0 0 0)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

 

Problem Solving:

Click Edit->Project Settings…->XR Plug-in Management->OpenVR and set Stereo Rendering Mode to Multi Pass.

[Solved] Unity packaged and exported apk error: Failed to load libmain.so’

Today I packaged the APK on my mobile phone and found that I couldn’t enter the main page, and it kept prompting
As shown in the figure below, the part of the package name is lost

insert image description here

Failure to initialize! Your hardware does not support this
application. Failed to load libmain.so’ java.lang.
UnsatisfiedLinkError: dalvik.system.PathClassLoaderl DexPathList|(zip
file “/data/app/ package name-v9hxALnNbA
vIVbwOmlIHfw==/base.apk”I,nat iveLibraryDirectories=|/data/app/
package name-v9hxALnNb AvIVbwOmlIHfw==/lib/arm64,/data/
app/package name-v9hxALn NbAvIVbwOmlIHfw==/base.apk!/
lib/arm64 -v8a, /system/lib64, /system/product/lib64ll couldn’t find
“libmain.so” Press OK to quit.

I checked several methods but couldn’t use it. Finally, I changed the compilation settings to solve the problem.
Changed to ARMv7 as shown in the figure and it will be normal. If ARM64 is needed, it can be solved elsewhere.
Now this is the case. The package is delivered normally, record it
insert picture description here

[Solved] Unity Error: Assertion failed on expression: ‘m_ErrorCode == MDB_MAP_RESIZED

Unity报错Assertion failed on expression: ‘m_ErrorCode == MDB_MAP_RESIZED

Assertion failed on expression: ‘m_ ErrorCode == MDB_ MAP_ RESIZED || ! HasAbortingErrors()’

Asset database transaction committed twice!

Assertion failed on expression: ‘errors == MDB_ SUCCESS || errors == MDB_ NOTFOUND’

The three errors are reported all the time without code prompt; The reason is that the Unity license has expired;

Solution: Restart Unity, open Unity Hub and reactivate the license; Re-open the project

[Solved] unity EditorGUILayer dynamic drawing scrolling list error

The specific error message: ArgumentException: Getting control 0’s position in a group with only 0 controls when doing Repaint A

OnGUI will be called two times each time it draws, the first time to calculate the position of all controls, all EdtorGUILayout control method returns the Rect is 0; the second time to draw all the content based on the position, the control method returns the Rect is the actual coordinates.

BeginScrollView to generate a scrolling list, because I need to display a lot of content, so I made an optimization: pre-calculate the position of each line, when the line is in viewport display content, otherwise display blank.

Generic logging found that the height of each row generated by the system is not the same, generally floating randomly between 19-21, so it is impossible to calculate the position of each row, so instead, when the second call to OnGUI, use the Rect returned by the control method to calculate in real time.

 

[Solved] Unity Publish WebGL Error: Unable to parse Build/webTest2.framework.js.gz

For H5 projects published directly, http-server or anywhere -p

When you open it at this time, you will find that the page is as follows:

Solution: PlayerSetting->Player->Publishing Setting

Check DecomPression Fallback

It can work normally after being released at this time, but it is not full screen:

In the released H5 project, edit index.html file

Directly modify the style of canvas:

<canvas id="unity-canvas" style="width: 100%; height: 100%; background: #231F20"></canvas>

Or insert code in <Script> :

  var canvas = document.getElementById("#unity-canvas");
    canvas.height = document.documentElement.clientHeight;
    canvas.width = document.documentElement.clientWidth;

This can solve the problem, but it is troublesome to modify it manually after each release. Later, we will study the automatic processing during release.

Or there are other full-screen settings.

[Solved] Unity Error: Deterministic compilation failed. You can disable Deterministic builds in Player Settings

preface

 

Unity error: deterministic compilation failed You can disable deterministic builds in player settings
this error was encountered when opening the old version of the project with the new version of unity

 

Solution:

1. Click Edit –> Project Settings

2. Click play –> Pull down to find Use Deterministic Compilation, then uncheck and restart unity

3. Done!

[Solved] New MAC Unity Develop Error: error installing cocoapods

The new MAC system is 11.4, and the installed Xcode version is 13.2.1
after opening a unity project and switching to IOS platform, cocoapods is installed in the background, but an error is reported indicating that the installation fails:

ERROR: Error installing cocoapods:
       ERROR: Failed to build gem native extension.
   current directory: /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/ext/ffi_c/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Framewoks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20220311-4106-wxounc.rb extconf.rb
   mkmf.rb can't find header files for ruby at /System/Library/Framewoks/Ruby.framework/Versions/2.6/usr/lib/ruby/include/ruby.h

You might have to install separate package for the ruby development environment,ruby-dev or ruby-devel for example.

According to the error prompt and query from the network, it should be that a new Ruby Version needs to be installed, and the ruby provided by the system cannot be used
installing Ruby requires RVM, and installing RVM requires homebrew

Install homebrew

Use the command /usr/bin/Ruby - e" $(curl - fssl) is not used here https://raw.githubusercontent.com/Homebrew/install/master/install )"

After installation, execute brew update update.

Then execute brew -vto see the installed version

Install RVM

Install RVM curl -L https://get.rvm.io | bash -s stable

reload RVM environment source ~/.rvm/scripts/rvm

View RVM version RVM -v

Install Ruby

Check the known version of ruby RVM list known

check the installed version of ruby RVM list

Install a ruby version. I chose 2.6.5 RVM install 2.6.5

After installation, check the Ruby Version Ruby -v. If it is not the version just downloaded, I need to use the command to cut the version

Install cocoapods

After the above installation, execute sudo gem install cocoapods -n/usr/local/bin to install cocoapods
after the installation, execute pod --version to view the version of cocoapods

Here, for unit packaging, cocoapods are not completely installed. You need to continue to follow the following steps.

Command + Shift + G, open to the folderpop-up window, and enter ~/.cocoapods, after opening the cocoapods folder, delete all the contents under it, create a new repos folder, open the command line tool, and execute the following three commands in turn

1) cd ~/.cocoapods/repos
2) git clone --depth 1 https://github.com/CocoaPods/Specs.git master
3) pod repo update

In this way, the Xcode project exported by unity will have Xcworkspace file (in case of problems in cocoapods environment, the exported Xcode project only has .xcodeproj file, and there are many exceptions when using this file for packaging press conference), and then open the file with Xcode for subsequent publishing

[Solved] Unity Error: Got null handle from IDXGIResource::GetSharedHandle

preface

Unity reports an error when playing the video: got null handle from idxgiresource:: getsharedhandle, which shows that the running program cannot play the video, but the sound can be heard. This problem is likely to be related to AMD’s unique display. If this error occurs, you can try the following solutions.

This solution takes the windows platform as an example, and other platform solutions are similar.

Solution

First of all, ensure the normal operation of the computer amd display driver, and ensure that unity automatically calls amd display. (if unity does not automatically call amd graphics card, you can add unity program at amd graphics card control panel.)

Open Edit - project settings in unity, select player , select PC platform, uncheck auto graphics APIs for windows in the options of other settings , and add Vulkan at graphics APIs for windows below the options, Delete or adjust the default direct3d11 to Vulkan , as shown in the following figure. After adjustment, you will be prompted to restart the unity editor. You can restart it. If you try to run again, you will not report an error.

[Solved] Unity Import Xcode Project Error: iOS framework addition failed due to a CocoaPods installation failure.

iOS framework addition failed due to a CocoaPods installation failure. This will will likely result in an non-functional Xcode project.

When unity exports the Xcode project, it relies on the third-party cocoapods library. The error is as follows.

Solution:

Although the warning is written in the error, the warning problem is solved and the error is no longer reported.

cd ~
vim .profile  # If not, execute the following command, if yes, fill in export LANG=en_US.UTF-8
touch .profile # New .profile
source .profile # Let it take effect

The specific error reports are as follows (part):

iOS framework addition failed due to a CocoaPods installation failure. This will will likely result in an non-functional Xcode project.

After the failure, "pod repo update" was executed and succeeded. "pod install" was then attempted again, and still failed. This may be due to a broken CocoaPods installation. See: https://guides.cocoapods.org/using/troubleshooting.html for potential solutions.

pod install output:



    [33mWARNING: CocoaPods requires your terminal to be using UTF-8 encoding.
    Consider adding the following to ~/.profile:

    export LANG=en_US.UTF-8
    [0m
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/unicode_normalize/normalize.rb:141:in `normalize': Unicode Normalization not appropriate for ASCII-8BIT (Encoding::CompatibilityError)
	from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/config.rb:166:in `unicode_normalize'
	from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/config.rb:166:in `installation_root'
	from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/config.rb:226:in `podfile_path'
	from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/user_interface/error_report.rb:105:in `markdown_podfile'
	from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/user_interface/error_report.rb:30:in `report'
	from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/command.rb:66:in `report_error'
	from /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:396:in `handle_exception'
	from /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:337:in `rescue in run'
	from /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:324:in `run'
	from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/command.rb:52:in `run'
	from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/bin/pod:55:in `<top (required)>'
	from /usr/local/bin/pod:25:in `load'
	from /usr/local/bin/pod:25:in `<main>'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/unicode_normalize/normalize.rb:141:in `normalize': Unicode Normalization not appropriate for ASCII-8BIT (Encoding::CompatibilityError)
	from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/config.rb:166:in `unicode_normalize'
	from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/config.rb:166:in `installation_root'
	from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/config.rb:226:in `podfile_path'
	from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/config.rb:205:in `podfile'
	from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/command.rb:160:in `verify_podfile_exists!'
	from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/command/install.rb:46:in `run'
	from /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
	from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/command.rb:52:in `run'
	from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/bin/pod:55:in `<top (required)>'
	from /usr/local/bin/pod:25:in `load'
	from /usr/local/bin/pod:25:in `<main>'



pod repo update output:

Updating spec repo `cocoapods`
  $ /usr/local/bin/git -C /Users/liuyongjie/.cocoapods/repos/cocoapods fetch origin --progress
  $ /usr/local/bin/git -C /Users/liuyongjie/.cocoapods/repos/cocoapods rev-parse --abbrev-ref HEAD
  master
  $ /usr/local/bin/git -C /Users/liuyongjie/.cocoapods/repos/cocoapods reset --hard origin/master
  HEAD 现在位于 9734315382c8 [Add] HBS-UI 1.1.0
Updating spec repo `ftsview-the-fotoable-cocoapods-specs`
  $ /usr/local/bin/git -C /Users/liuyongjie/.cocoapods/repos/ftsview-the-fotoable-cocoapods-specs fetch origin --progress
  $ /usr/local/bin/git -C /Users/liuyongjie/.cocoapods/repos/ftsview-the-fotoable-cocoapods-specs rev-parse --abbrev-ref HEAD
  master
  $ /usr/local/bin/git -C /Users/liuyongjie/.cocoapods/repos/ftsview-the-fotoable-cocoapods-specs reset --hard origin/master
  HEAD 现在位于 8984dba [Update] FtAdsPlatform (4.4.8.4)


    [33mWARNING: CocoaPods requires your terminal to be using UTF-8 encoding.
    Consider adding the following to ~/.profile:

    export LANG=en_US.UTF-8