Is it possible to use Unity3D NavMesh in a server application? - unity3d

Unity3D contains a core dll that called UnityEngine.dll. That library contains all logic for the engine, like NavMesh.
Is it possible to use that dll in other applications, for example console applications, feed NavMesh with baked NavMesh from scene and perform navigation?
In other words, I want to create a game server that will navigate all agents and send to clients new positions of them.

No it is not possible.
This question was asked by a Unity user few years ago and he got the no answer from a Unity engineer. He tried that and failed. Unfortunate I am not able to find that question again but the answer the user got made sense.
According to the post as I remember, he said that all the UnityEngine.dll file contains all the classes you see while programming and those are for reference and complier only. He also said that the UnityEngine.dll file does not include the run-time file required to make it work alone in other application.
The Unity compiler generates the required dlls or files needed to run a Unity game.

Related

Can you turn a Unreal Project .EXE into .uproject?

I have a .exe file, called Sonic Infinity Engine Plus, that was built in UE4.
This was released public without source code download, so I am unable to modify it.
However, this game was released with an Unreal terminal (accessed by the `/~ key). I'm wondering if there is any way I could retrieve the source code.
Image of terminal in-game
If anybody knows such command, like build source, it would be helpful to know.
If you need more information I couldn't think of off the top of my head, please let me know!
Thanks, Omega207
As user Rotem replied, there is no known way to retrieve the "source code" as I thought it could. This is due to complications with decompiling UE4 source code.
This is due to the fact that Unreal tends to hide source to most who use it, and is therefor up to the creators to distribute source code (which is all the files creating the .exe file).
Since the source was never distributed public, there is officially no possible way to modify this engine as the creators meant it to be.

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.

TypeLoadException after loading .NET 4.5 C# DLL into Unity 2018.2.5

I want to be able to feed the camera frames from a webcam into Unity. I made a .NET 4.5 C# DLL using MediaFrameReader and event listeners. Here is some other user's implementation for accessing the Hololens camera frames: Hololens - Access Camera Frames.
When I import the DLL into my 2018.2.5 Unity project, it gives me the following error:
Unloading broken assembly "....", this assembly can cause crashes in the runtime
TypeLoadException: Could not find method due to a type load error
The C# plugin built successfully many times on Visual Studio. Also, I have properly set the Api Compatibility Level (in player settings) to .NET 4.x. What could be the fix to this?
All the other SO answers related to this I have already taken a look, but does not seem to help the problem. Thanks for all the help.
EDIT: https://issuetracker.unity3d.com/issues/unity-fails-to-load-net-4-dot-6-assemblies-with-typeloadexception is the most relatable post, but had no solution.
I have few possible solutions for you to explore.
DLLs issues:
Workaround:
Comment your UWP code (the part that uses the DLL), then build it in UNITY without the DLL. In the generated UWP solution, install the package from nuget or manually import the dll, then uncomment your code and finish your development. This is a short-term solution.It is going to be annoying as you re-build your solution many times and have to comment/uncomment then re-add dlls and so on.
Other possible solutions:
Failed to run reference rewriter with command error with unity error when adding a DLL to the assets folder
Your exact need
From your description, you really do not need everything in the link you referenced (Hololens - Access Camera Frames). You need much simpler version. I recently created MediaCapture solution for HoloLens as a workaround because PhotoCapture in Unity is not working in the HoloLens and everything is working without any additional DLLs. I will post for you few links to see if it may help you:
MediaCapture Unity & HoloLens: https://github.com/MSAlshair/HoloLensMediaCapture
This maybe a good start for you. You can combine it with your original reference. Use this project as starting point to make sure your project is building correct, then use the necessary code from the other resource that you posted to accomplish the task that you desire. You may need to download Unity 2018.2.12f1 because I didn't test it in 2018.2.5
MediaCapture & PhotoCapture: Hololens font camera
Good Luck!

Is it possible to import an entire game (from exe-file) to a new Unity Project?

Let's say I have a game that is already built with Unity. I do not have its source-code, only the exe-file is present. Now, I need to add some new features on top of it. Is it possible to import the existing game to a new Unity project, e.g. by adding it to an empry GameObject?
Without the source, no it is not.
Additionally you may not have a good legal standpoint unless you have express permission to modify the game (in which case you could simply ask the developer for access to the source), or the license is suitably open.

How does Unity3D's web-deployment work?

It's very slick and cross browser/platform at the click of a button, which is leading non-technical types to conclude the entire engine is intrinsically better than what we use now. Is it simply that they've taken the time to implement all the per-browser/OS plugin versions of Unity WebPlayer and polish it, or is there anything deeper in the way the engine architecture is set up?
Unity takes scripts written in C#, UnityScript (based on JavaScript), or Boo (based on Python), and compiles them into mono assemblies. Those assemblies + the 3d models, sounds, and textures required by your game are compressed into a .unity3d file that is loaded by their browser plugin. Since almost all of the game's logic is in managed mono assemblies it runs cross platform with very few platform specific quirks.
They've recently rewritten their plugin detection and installation code so that it is very easy to drop a block of javascript into a web page that shows Unity content if the user has the plugin, or other content (image, flash, video) if they don't. I believe their plugin supports all A-class browsers on Mac and Windows, and the plugin can be installed without restarting the browser.
One advantage of the Unity engine is that you can take a lot of off-the-shelf managed assemblies and include them in your project and call them from Unity code. But you have to be aware that these assemblies can really bloat the size of the .unity3d file.
Another advantage is that you can easily write components that expose tunable parameters that can be modified by non-technical people.
And yet another advantage is that a well written project can be ported to/from iPhone, Standalone, Android, Web, etc. in under a day. I've personally done iPhone to Web by just modifying my input handler and changing texture compression.
One big disadvantage is that since the application is running managed code it is not too difficult for a curious or malicious person to decompile the assemblies into completely readable code. So you need to think about what someone could do with that info (cheat in multiplayer, write bots, falsify high scores, etc.). It is possible to obfuscate your assemblies, but it isn't trivial to add this step to your build process.