Unity.Mathematics | math library used in Unity providing vector types | Math library

 by   Unity-Technologies C# Version: 1.2.5 License: Non-SPDX

kandi X-RAY | Unity.Mathematics Summary

kandi X-RAY | Unity.Mathematics Summary

Unity.Mathematics is a C# library typically used in Utilities, Math, Unity applications. Unity.Mathematics has no bugs, it has no vulnerabilities and it has medium support. However Unity.Mathematics has a Non-SPDX License. You can download it from GitHub.

A C# math library providing vector types and math functions with a shader like syntax. Used by the Burst compiler to compile C#/IL to highly efficient native code. The main goal of this library is to provide a friendly Math API familiar to SIMD and graphic/shaders developers, using the well known float4, float3 types...etc. with all intrinsics functions provided by a static class math that can be imported easily into your C# program with using static Unity.Mathematics.math. In addition to this, the Burst compiler is able to recognize these types and provide the optimized SIMD type for the running CPU on all supported platforms (x64, ARMv7a...etc.). NOTICE: The API is a work in progress and we may introduce breaking changes (API and underlying behavior).

            kandi-support Support

              Unity.Mathematics has a medium active ecosystem.
              It has 1279 star(s) with 151 fork(s). There are 649 watchers for this library.
              It had no major release in the last 12 months.
              There are 47 open issues and 58 have been closed. On average issues are closed in 86 days. There are 3 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of Unity.Mathematics is 1.2.5

            kandi-Quality Quality

              Unity.Mathematics has 0 bugs and 0 code smells.

            kandi-Security Security

              Unity.Mathematics has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              Unity.Mathematics code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              Unity.Mathematics has a Non-SPDX License.
              Non-SPDX licenses can be open source with a non SPDX compliant license, or non open source licenses, and you need to review them closely before use.

            kandi-Reuse Reuse

              Unity.Mathematics releases are available to install and integrate.
              Installation instructions are not available. Examples and code snippets are available.
              Unity.Mathematics saves you 71 person hours of effort in developing the same functionality from scratch.
              It has 184 lines of code, 23 functions and 190 files.
              It has high code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Unity.Mathematics
            Get all kandi verified functions for this library.

            Unity.Mathematics Key Features

            No Key Features are available at this moment for Unity.Mathematics.

            Unity.Mathematics Examples and Code Snippets

            No Code Snippets are available at this moment for Unity.Mathematics.

            Community Discussions


            Unity error "Internal build system error. Backend exited with code -1073740791." has Destroyed/Killed my Project
            Asked 2022-Apr-05 at 12:00

            Ok I might be over Exaggerating here but it's true, the project is broken due to error when I start opening it "Internal build system error. Backend exited with code -1073740791".The app of this Project has already been released on Google Play, maybe there is something to do with the settings? Can Please Anyone Help?

            The Full Error:



            Answered 2022-Apr-05 at 12:00
            1. Back up everything now in case anything you try makes things worse. If you have any previous backups be sure to keep them safe. While unlikely, if it turned out the issues were caused by drive trouble it could be that the drive is on the verge of failing.

            2. After having backed everything up, try closing Unity and then deleting the Library\Bee folder from your project directory. Hopefully your problem is now solved.


            1. If your problem was not solved: try deleting or moving the following folders and files from your project folder:
            • .vs
            • Library
            • obj
            • Temp
            • UserSettings
            • .vsconfig
            • *.csproj
            • *.sln

            Basically everything except Assets, Packages, and ProjectSettings (unless you added any custom files or folders to the root folder manually, though even if so you just backed them up a moment ago right?)

            1. If your Unity project directory is under an unusual or long full directory name e.g. C:\Users\Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch\Documents\Unity Projects\UnityProject or C:\Users\JokūbasØy̸̧̓ṽ̴͉̬̰̌͘ì̷͓ṋ̶̮̓͊͝d̴̢̫͉͋\Documents\UnityProject, try moving it somewhere simpler like C:\Unity\UnityProject.

            2. Restart your PC. You can never be too certain of what problems might potentially be fixed by turning it off and on again.

            3. Load the project into Unity and pray it imports successfully this time.

            If none of that works: If you updated Unity immediately before the problem began, reinstall the older version and try the above steps again. If that fails too, trying a newer Unity version in desperation would not be unreasonable. Probably the Bee folder thing solved your problem and you never got here though.

            Source https://stackoverflow.com/questions/71750529


            Unity Script only works with long namespace name
            Asked 2022-Feb-03 at 17:45

            I tried following this Unity ECS Entity Manager Tutorial from Turbo Makes Games. I'm using Unity 2020.3.20f1.1086.

            The Code works initially but I noticed, that Line 20 in SpawnEntitiesSystem.cs EntityManager.SetComponentData(newEntity, newPosition); stops working when I change or remove the namespace. After tinkering a bit with the code I can reproduce that the specific namespace is not important but the namespace has to be at least 18 characters long for the code to work as expected. If I change the namespace to 17 characters all entities are spawned at the same place. Other code after the faulty line 20 was executed but for readability I removed it from the code example. (Originally user input was also handled and in OnStartRunning a component was added to the new entitiy)

            I only heard of similar problems in e.g. C++ when using pointer maths but I thought something like this shouldn't happen in C#. Does anyone have an idea what the core problem could be?

            What I already tried without succes

            • restart Unity
            • delete Library, Obj and Logs folders
            • write code from scratch in new project
            • restart PC




            Answered 2021-Nov-07 at 13:58

            A workaround is to set the Translation instead of the LocalToWorld Data.

            Working code:

            Source https://stackoverflow.com/questions/69842958


            Rotating quaternion smoothly with acceleration and deceleration. Equivalent of max/min for quaternion?
            Asked 2021-Mar-10 at 14:38

            I have this code for my linear acceleration and deceleration.



            Answered 2021-Mar-09 at 18:51

            Some of the more practical ways of clamping a quaternion can easily done once it is broken down to angle/axis form, then clamping those as desired:

            Source https://stackoverflow.com/questions/66546884


            Error when importing mathematics in Unity3d
            Asked 2020-Oct-12 at 13:12

            When I try to import mathematics it throws me an error saying that

            '' error CS0234: The type or namespace name 'Mathematics' does not exist in the namespace 'Unity' (are you missing an assembly reference?)''

            I tried, Using System.Mathematics, Using Unity.Mathematics I also tried by typing Math instead of Mathematics. Idk why this is throwing an error, I use Notepad++ for scripting.

            [1]: https://i.stack.imgur.com/vNs9J.png <--- Error picture



            Answered 2020-Oct-03 at 15:57

            You are just missing the Unity.Mathematics Package.

            You will have to add the package using Package Manager -

            There are 2 ways you can do this -

            Solution 1:

            a) Go to Unity and launch Package Manager

            b) In the Package Manager, you will find a + Symbol then select "Add package from git URL.."

            c) Give this Url in the box: https://github.com/Unity-Technologies/Unity.Mathematics.git and click on Add

            If the above Solution 1 is not working for some reason, you can Manually add it

            Solution 2

            You will have to download the package locally and then install

            Download link: https://github.com/Unity-Technologies/Unity.Mathematics/archive/master.zip

            Steps to be followed once you download.

            a) Extract the zip file using any zip extractor application (Notably WinRar) and note the location.

            b) Next, Go to Unity Package Manager and click on "+" Symbol again, But this time Select

            "Add package from disk..."

            c) Go to the path where you have extracted the package, yourlocation\Unity.Mathematics-master\Unity.Mathematics-master\src\package.json

            Select the package.json and click on open

            The package will start installing and then it will import the package automatically into project.

            It will take sometime to install, if its fails an error would be displayed in your console stating the installation didn't complete. For me Solution 2 had worked perfectly.

            Source https://stackoverflow.com/questions/64185330


            How to smooth between multiple perlin noise chunks?
            Asked 2020-Aug-15 at 19:02
            Smoothing Between Chunks

            So I've been working on a game in unity and want to expand my world from a 150x150 map into a seemingly infinite procedural world. My plan is to use Perlin Noise as the base and use the different values from 0-1 to determine the terrain type. The issue I'm running into is when I draw out my chunks and offset accordingly my chunks do not line up correctly, which kind of break the illusion of an infinite world.

            (seen here)




            Answered 2020-Aug-14 at 07:01

            The key word you are looking for is tileable.

            But I have a great news for you, noise function such as perlin are periodic in nature. So instead of calling ChunckSize * ChunkSize a noise function you should only call it once and then divide the results.

            I will advice you to read this excellent tutorial:


            Source https://stackoverflow.com/questions/63407212


            Unity3D on Ubuntu 19.10 with vscode and C# extension : get an error and the autocomplete doesn't working
            Asked 2020-Apr-05 at 17:26

            I'm a web developer (symfony <3 ;) C# and microsoft technologies are new for me ! ) and during the covid containment I want create a simple game with the game engine unity

            On Ubuntu 19.10, I downloaded unity Hub v2.3.0 (https://unity3d.com/get-unity/download)

            From unity hub, I installed unity3D v2019.3.7f1 (the lastest stable) with some options (Linux & WebGL & windows build support)

            And I created a simple 2D game

            All works like a charm, I can open my project and run my new game without any error in the unity3D console

            From Unity, when I create a c# script, the file can be opened by my (very simple) text editor gedit. Now I want to install the cross-os IDE visualcode thanks thats I'll get some usefull extensions and autocompletion code when I'll edit my unity scripts.

            So, I installed vscode via apt install (I followed this official guide : https://code.visualstudio.com/docs/setup/linux)

            My version of vscode is :

            After some web search, I understand I must install the .NET framework (maybe I'm wrong ?)

            My dotnet version (from a terminal : dotnet --version) is 3.1.201

            Next I configured the unity parameter for change the default text editor :

            • External Script Editor : code
              • code refer to the path /usr/bin/code, the executable of vscode
            • External Script Editor Args : "$(ProjectPath)" -g "$(File)":$(Line):$(Column)
              • value by default, I changed nothing

            I created a simple c# script from unity, I opened the file and vscode opened automatically (yeah !). And from vscode I added two public variables (the bool 'a' and the Rigidbody2D 'b')

            I saved my script and go to unity app, the variables a and b are visible on the interface :

            All works ! But now, I want have the autocomplete code from vscode. So, I installed the vscode c# extensions. But when the installation finished, this message appears :

            The whole of log is :



            Answered 2020-Apr-05 at 14:41

            This warnings is a known Visual Studio Code Editor 1.1.4 bug. According to this information, it's Omnisharp extension that is causing the error:

            This issue is caused by an extension, please file it with the repository (or contact) the extension has linked in its overview in VS Code or the marketplace for VS Code. See also our issue reporting guidelines.

            Happy Coding!

            For me, downgrading to version 1.1.3 of the package fixed the problems.

            In UnityEditor go to: [Window]->[Package manager]->[Visual Studio Code Editor]->: Select 1.1.3 version and click to "Update 1.1.3" Button.

            If the errors don't go away after that:

            • 1) Changed "com.unity.ide.vscode": "1.1.3" in "Packages/manifest.json"
            • 2) In UnityEditor go to: [Edit]->[Preferences]->[External Tools]: Set "Generate all .csproj files" CheckBox to true.
            • 3) In UnityEditor go to:[Assets]->[Reimport All]

            Some people say that, if you downgrade to 1.1.3 and right after upgrade to 1.2.0 errors should be fixed, but I haven't tried it.

            Source https://stackoverflow.com/questions/60998457

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network


            No vulnerabilities reported

            Install Unity.Mathematics

            You can download it from GitHub.


            We don't yet accept PR on this repository. See the FAQ below. The project is using editorconfig to keep files correctly formatted for EOL and spaces.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
          • HTTPS


          • CLI

            gh repo clone Unity-Technologies/Unity.Mathematics

          • sshUrl


          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Reuse Pre-built Kits with Unity.Mathematics

            Consider Popular Math Libraries


            by KaTeX


            by josdejong


            by matrix-org


            by gonum


            by MikeMcl

            Try Top Libraries by Unity-Technologies


            by Unity-TechnologiesC#


            by Unity-TechnologiesC#


            by Unity-TechnologiesC#


            by Unity-TechnologiesC#


            by Unity-TechnologiesC#