Due to the recent development of game find Road A * is used very frequently. So it's a logical bottleneck. C # is one times slower than C + +. So decide on C + +. This is an optimization. haha.
On vs VC + +. Sub-managed and unmanaged mode. Managed mode is C++/CLI also says you can use. NET libraries in C + +. And the CLR are together. Also, unmanaged mode is the traditional C + + direct call Win32 API.
You can create a DLL in either of these ways. But it's more convenient to use it with C #. Here's how to Unity3d using the CLR's c++/cli. The internet is full of the use of unmanaged mode C + + and unity used in the way, where the Buddha is not elaborated.
The book belongs to the story:
Environment:
1. vs2012 or vs2013.
2. unity4.3.0
First, the creation of a CLR project.
Open vs. then new. This is the choice. A CLR Library project.
Then you enter the project. Then add the following code to test whether the DLL is being used. A and B are added to return the result. Very simple program.
After that, you need to change the properties of some items. Because Unity uses the mono reason.
The 1.framework3.5 is a unity version. Here my vs is 2012/2013 using FW 4.5. So high here needs to be lowered. Because there is no option in the IDE, you need to open the Proj file to modify the version.
It's OK to change the v4.5 into v3.5.
2.CLR is also a lot of versions. Unity supports safe's CLR. So this also needs to change.
Right Key property above the item.
Choose Safe's CLR. It's OK. Then compile it out of the DLL.
And in the end, copy the DLL to unity. Unity needs to build a plugin folder to store the DLL.
After putting it in this folder, unity can be used.
Then we create a Unity C # script. To invoke the TSENGINECLI.
Then drag the C # script onto a random gameobject. Run it. You will see 3 output in the console box. The description is done. Wow, quack.
All right, I hope you all have a good time. Happy knitting.