-2

If I write a library for chess ai in C or C++ and I used in Unity with C# then is this library compiling fast like in C or slow like in C#.

For example; There is a code compiling in C 7secs and C# 1min. So, what will I see in Unity?

(F. Sorry for my bad language.)

Bahattin
  • 25
  • 5
  • Compiling "takes time" in any programming language, excepting, perhaps, Pascal. The time difference isn't usually as relevant as the overall build system, and Unity and Unreal have significantly different pipelines in this regard. Some people prefer one over the other, but it's highly subjective. – tadman Dec 03 '20 at 05:20

1 Answers1

1

Firstly, I don't know about those times, but let's assume you're right. You don't generally write C or C++ code that Unity will compile. You would compile your code to a DLL and include that DLL in your Unity project. As such, there would be no compile times for that specific DLL. It's not a bad practice if you've got a library that you don't need to compile often.

Another method to reduce compile times is to use Assembly definitions. This does a very similar thing to compiling your library in to DLLs, but is done "within the Editor". The basic premise is that once a project is compiled, it doesn't need to be compiled again unless there were changes made to it.

The Unity Docs here go into full detail.

Milan Egon Votrubec
  • 3,696
  • 2
  • 10
  • 24