kandi X-RAY | UnityCsReference Summary
kandi X-RAY | UnityCsReference Summary
Unity C# reference source code.
Top functions reviewed by kandi - BETA
UnityCsReference Key Features
UnityCsReference Examples and Code Snippets
Trending Discussions on UnityCsReference
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:...
ANSWERAnswered 2021-Jun-10 at 11:38
I'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
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
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?
ANSWERAnswered 2021-Apr-09 at 16:42
I 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.
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....
ANSWERAnswered 2021-Mar-25 at 23:02
Unity 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.
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:...
ANSWERAnswered 2020-Dec-13 at 14:59
It's not the full unity source code, it's just a repository with C# references. All c++ sources are still not accessible.
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...
ANSWERAnswered 2020-Apr-10 at 21:58
There are four steps to achieving the functionality you want.
- Detect all types with the appropriate attribute. You can do this by looping through each
AppDomain.CurrentDomain. You'll want to cache these types each time your script assembly reloads, which you can check with a static class and the
InitializeOnLoadattribute 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
- Check if any component has been added to the scene that shouldn't be there. This can be accomplished with the
UnityEditor.SceneManagement.EditorSceneManagerclass 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
No vulnerabilities reported
Reuse Trending Solutions
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page