UnityCsReference | Unity C # reference source code | Game Engine library
kandi X-RAY | UnityCsReference Summary
kandi X-RAY | UnityCsReference Summary
Unity C# reference source code.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of UnityCsReference
UnityCsReference Key Features
UnityCsReference Examples and Code Snippets
Community Discussions
Trending Discussions on UnityCsReference
QUESTION
For my research I need to know, how exactly Unity implements the Slerp function for Vector3.
The Unity3D documentation descripes, that the input vectors are treated as directions rather than points in space. But it doesn´t explain, if there are quaternions used intern.
The Unity3D-C#-Reference mentionied Vector3.Slerp here:
...ANSWER
Answered 2021-Jun-10 at 11:38I'm of course not sure because we don't have the source code for these internal methods but I'm pretty sure they would not use Quaternion
which would be pretty imperformant but rather use pure and simple float based math like sinus, cosinus etc something that in c#
would look somewhat similar to e.g. the solution mentioned here
QUESTION
This is probably a very niche question, but what are the specific differences between an asset bundle and a cached bundle for the asset bundle system that Unity 4 used? I'm curious how cached files differ to asset bundles and what, if any, different properties change from both types of files? I.E. What happens to asset bundles when they are cached through WWW.LoadFromCacheOrDownload
?
Unity unfortunately doesn't have this process documented as the open source code calls an internal function called INTERNAL_CALL_WWW(this, url, ref hash, crc)
, which is given the instance of WWW, the string of the URL, a Hash128 and a UINT called crc with a default value of 0. (Referenced decompiled 5.3.2p2 code, 2017+ code is on the official Unity GitHub, but seems to differ from Unity 2015 code).
The Unity 2017 code leads to the private extern static IntPtr CreateCached(DownloadHandlerAssetBundle obj, string url, string name, Hash128 hash, uint crc);
external method, which isn't documented either.
Furthermore, what actually happens when an asset bundle is cached so that the engine can recognise the file is in cache and doesn't need to be downloaded? Is it just simply that it searches for the hashed name in the cache, or does it do something more intricate?
Frostrix
...ANSWER
Answered 2021-Apr-09 at 16:42I can clearly see the difference in size between created asset bundles (those to put on server to download later) and cached asset bundles (those downloaded once at runtime and stored to the device). On Windows you can find them at %appdata%/Local Low/Unity/company+name_of_app. Cached versions are typically less compressed so the app can load them faster, while those stored on the server are more compressed so it takes less bandwidth to download. The content should be the same, but compressed using different methods. See this docs page for more details.
QUESTION
I am messing with Unity's cameras for a school project, my plan was to change the way that coordinates are projected onto the projection plane to a projection onto a sphere using sphere coordinates. But, getting to the actual math behind the cameras has been a bit of a pain.
My first method involved messing with render textures but, theoretically, that won't work because the camera has already rendered a texture which I am modifying.
Next I tried to get into the code for the base camera, maybe make a copy of the camera to modify without messing the original, but then I ran into this, the code that sets all of the camera's parameters for the editor, I saw the reference to a few .h files.
Where can I access these files? I found files with the same names but not related to Unity. They were also different from each-other, making me think that the file above isn't referring to some sort of industry standard, but it might be.
...ANSWER
Answered 2021-Mar-25 at 23:02Unity is generally considered to be made up of two parts; the managed front end, and the unmanaged back end. The front end code (written in C#) can be studied on GitHub here. The unmanaged code (written in C++) is proprietary and isn't freely available.
Unity is fairly modifiable, but there are a number of rules you have to follow.
A camera workaround might be to work with the Scriptable Render Pipeline (e.g. URP). But I'm not sure this actually addresses what you're trying to achieve.
QUESTION
I'm C++ developer and never done C# before. By curiosity, I was looking at the code of Unity and I do not sure to understand the following code:
...ANSWER
Answered 2020-Dec-13 at 14:59It's not the full unity source code, it's just a repository with C# references. All c++ sources are still not accessible.
QUESTION
I am trying to create a custom class attribute for Unity that prevents a targeted MonoBehaviour from existing on more than one object in a scene. I have done some searching and it's been said that in order to get the Type of class the attribute is targeting, I should use the constructor of the attribute; it can't be done using reflection
...ANSWER
Answered 2020-Apr-10 at 21:58There are four steps to achieving the functionality you want.
- Detect all types with the appropriate attribute. You can do this by looping through each
Assembly
inAppDomain.CurrentDomain
. You'll want to cache these types each time your script assembly reloads, which you can check with a static class and theInitializeOnLoad
attribute from the editor. (You definitely don't want to be doing reflection if you don't have to). - Detect when objects are added/modified in the scene hierarchy. This can be accomplished with the event
EditorApplication.hierarchyChanged
. - Check if any component has been added to the scene that shouldn't be there. This can be accomplished with the
UnityEditor.SceneManagement.EditorSceneManager
class by looping over all root objects in the scene and tracking the appropriate information. - Decide what to do if you encounter multiple of the same component (destroy, show a message to the user, etc.). This one is sort of up to you, but I've included a logical answer below.
This can be achieved with the following attribute
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install UnityCsReference
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page