Finding built-in Unity scripts - unity3d

If one would like to look into the core files of the Unity Engine, e.g: I've tried using the unity in-built "Fog" effect, but would like to see how it works on a deeper level (code). Is this something one can find, or is it encrypted in some way?

You can try to take a look at Unofficial unity decompiled repo to check if there are sources you're looking for. It's a decompiled verison so there is no guarantee that it's the actual code. Also big part of Unity's sources is written in C++ and C# scripts just call this Unity's native C++ part, so it's really incomplete.
The other option is that some of big companies, Unity's partners which have highest support level, have access to official source code. So may be you're able to find someone with access to sources.

Related

Is there a way to convert a game made with ImpactJS to Unity?

I know that is possible export Unity projects to WebGL, but is there a way to use code from a ImpactJS project on Unity?
I checked the web for converter and found none, so unless I missed something, what you are trying to do is impossible.
There is always a way to convert. Sometimes it may require some manual fixing. Generally most languages are similar enough that you can automate many parts. The art assets are often re-usable, for example.
No. Unity converts it's own framework and system of gameobjects and c# code that you write into WebGL code.
However, if you have computing and business code that does not do much with the canvas/UI then that code can be copied over somewhat. For code that is purely computational or business logic, you can use any online tool to convert javascript into C# code with some success.
My guess is that if most of your code dealt with the canvas and UI and interaction, that none of that code will be able to be reused.

How to include Unity3d libs in a non-Unity3d project?

I'm developing a C# library that will be used either as a plugin in some Unity3d projects and also used in non-Unity3d projects.
I need to use some Unity3d classes (such as UnityEngine.Matrix4x4) and standardize some functions to use valid types agnostically to whether the project is an Unity project or not.
So, as the title says: what is the right way to include Unity3d libraries in a non-Unity3d library project? Should I just include reference to the local Unity3d binaries (like UnityEngine.dll) in my project? If so, which is the right folder to look for these binaries (they appear in some different folders in the unity installation folder)?
If you are not actually running the Unity Engine for rendering or handling input it may be the case of forcing a round peg into a square hole, both technically and legally.
The most elegant solution would likely be to write your library in C# using more agnostic libraries. For example the Matrix4x4 class you mentioned has an equivalent in System.Numerics. Alongside the library all thats needed is a light wrapper converting a System.Numerics.Matrix4x4 to a UnityEngine.Matrix4x4. Sometimes the Unity devs themselves do stuff like this, for example the Unity.Mathematics.float3 struct which works better in ECS land than a standard Vector3.
FYI if you're looking for how some particular system works, check out the C# Reference GitHub Repository, for example the Matrix4x4 struct. Just be aware that 'copying and pasting' Unity source code is not allowed.

Can F# be used with Unity (game engine)?

I'm getting into Unity, and wondering if I can use F# instead of C#, simply because I prefer the syntax. I'm guessing not, since the environment it runs on is very different, but maybe there's something that will cross-compile code or something else I'm not thinking of.
I can't help but get the impression that the other answers were written by people who do not really know what they are talking about.
This is what you need to do to use F# in a Unity project:
Create an F# project that compiles into a dll. Have it build into the assets folder of a Unity project.
Add references to UnityEngine.dll and/or UnityEditor.dll. Change the reference properties so the dlls aren't copied to the build folder.
Of course you can't create new F# classes from within the Unity editor this way, but you can assign the ones you wrote in F#.
Currently you need to enable the (experimental) support for .NET-version 4.5. Alternatively you can download an older version of the FSharp.Core.dll that supports .NET 3.5. (see here).
I can't guarantee that you won't run into trouble because of compatibility issues with the FSharp.Core.dll, but that's just a guess since I haven't tested it myself.
I had success doing this sometime back by following this Github project: https://github.com/eriksvedang/FSharp-Unity, which I believe is roughly the same as Lars Kokemohr's answer above. I haven't tested it in more recent versions of Unity/Mono however.
Yes you can use F# as first class language as C# in unity.
Here is an article about it link
an excellent blog for One who want to use F# in unity
if you want to use F# as second class which I recommend.
let me show how to do it.
Usually what I do is to create Game Domain in F# in .net standard
2.0 library project build it.
Make unity API Compatibility level .net standard 2.0 then
Import library project dll in asset/plugins in Unity
Here is an explanation on how to do it automatically after each build : link
You will get this error, here is the solution
Having said that I recommend not to do any serious work in unity with F# because you won't be able to cross compile to other platforms.
Unity uses IL2cpp and it don't work with F#.
In simple words unity don't support F# and if you are having issues like bugs in Il2cpp unity will not fix it because they don't support F#
There is no easy way to do this but if you REALLY want to make it happen I believe you could use something like fs2cs:
https://github.com/hsharpsoftware/fs2cs
In theory you could write a script that calls fs2cs on all of your Unity C# files. Integrating this with Unity itself would be the more challenging part, but in theory you can trigger fs2cs transpilation on save of your file and Unity can use the transpiled C# file.
Only Boo, C#, and UnityScript are officially supported!

Where can I find good open source code flow visualization software?

I am working on an academic research regarding some very long functions in the Linux kernel (link, link).
For that research, I would like to use some code flow visualization tool, that would be able to plot a graph in which each vertex is a decision point and each edge is a piece of code which runs in a consequent way.
Do you know of any good, open source project that can visualize C code?
Perhaps a tool like KCacheGrind would be of help. It generates call graphs based on actual calls and cannot pre-generate a call graph without actually running the program, which may not suit your needs, but then it again it may.
History flow's are very neat for changes/diff across multiple versions.
Codeplex has a project, Dependency Visualizer which does support C also.
Gprof2Dot can render oprofile, this would get you dynamic info also.
CodeViz also (static tool) would work.
If your using gcc, gcc-xml has an introspector plugin also todo this.
You appears to want to acquire a flowchart of C source code ("decisions", "code blocks").
Something like this C flowchart?
To do this correctly, esp. for Linux kernal code, I'd expect you to have to preprocess the code first to get rid of macros and conditionals. I would assume that GCC would construct such a graph internally and that you ought to be able to get your hands on that graph.
Doxygen does some amount of 'visualization',
but you need to work on the code a bit for it to be usable.
Another interesting thing to check would be lxr
Linux Cross Referencer is a software toolset for indexing and presenting source code repositories. LXR was initially targeted at the Linux source code, but has proved usable for a wide range of software projects. lxr.linux.no is currently running an experimental fork of the LXR software.
I can recommend Sourcetrail. Can work with a compile_commands.json. Not sure if it's still maintained, though. But it's foss and you can fork it!

What is the best/a very good meta-data reader library?

Right now, I'm particularly interested in reading the data from MP3 files (ID3 tags?), but the more it can do (eg EXIF from images?) the better without compromising the ID3 tag reading abilities.
I'm interested in making a script that goes through my media (right now, my music files) and makes sure the file name and directory path correspond to the file's metadata and then create a log of mismatched files so I can check to see which is accurate and make the proper changes. I'm thinking Ruby or Python (see a related question specifically for Python) would be best for this, but I'm open to using any language really (and would actually probably prefer an application language like C, C++, Java, C# in case this project goes off).
There is a great post on using PowerShell and TagLibSharp on Joel "Jaykul" Bennet's site. You could use TagLibSharp to read the metatdata with any .NET based language, but PowerShell is quite appropriate for what you are trying to do.
use exiftool (it supports ID3 too). written in perl, but can also be used from the command line. it has a compiled windows and mac version.
it is light-years ahead of any other metadata tool, supporting almost all known audio, video and image files, supports writing (not just reading), and knows about all the custom/extended tags used by software (such as photoshop) and hardware (many camera manufacturers).
#Thomas Owens PowerShell is now part of the Common Engineering Criteria (as of Microsoft's 2009 Product Line) and starting with Serve 2008 is included as a feature. It stands as much of a chance to be installed as Python or Ruby. You also mentioned that you were willing to go to C#, which could use TagLibSharp. Or you could use IronPython...
#Thomas Owens TagLibSharp is a nice library to use. I always lean to PowerShell first, one to promote the language, and two because it is spreading fast in the Microsoft domain. I have nothing against using other languages, I just lean towards what I know and like. :) Good luck with your project.
Further to Anon's answer - exiftool is very powerful and supports a huge range of file types, not just images, but video, audio and numerous document formats.
A Ruby interface for exiftool is available in the form of the mini_exiftool gem
see http://miniexiftool.rubyforge.org/