Unity calls C++ dll with class and pointer operations

This is based on the previous unity calling C++ dll operation to upgrade the matryoshka function call_Heaven and Man Unity peng's blog-CSDN blog , but in reality, classes are nested with each other, which is very difficult to handle.

1 Test whether the dll program directly generated from main() can run.

 Discovery is possible.

2 That is to find a way to write the next-level function of the object or pointer operation directly into the main, isn't it all right?

 Only through this function to obtain the calculation result, you can directly write this function here, which is equivalent to not needing this function.

This problem can be solved now. 

But faced with a new problem: if there is a loop in the called function, then when it is in unity, it can only be started, but in this way the unity project cannot be moved, and it can only be moved after the called loop is executed.

What we hope is that the cycle will proceed normally, and the unity project can also be moved.

Depending on the situation, modify it into a new function (the previous function part contains a loop part ----- finally call it in update, which is similar to a loop), and put the other function in another function, two functions The common variable of the application will be a global variable.

In this way, both can run normally, but if there is a window that can be closed in a loop, it may be powerless. This is equivalent to closing it in the previous program, because update has been called, and it will be reopened, which is quite cannot be closed.

For this problem, a bool value may be used to control whether to call it again in update, which needs to be tested.

Guess you like

Origin blog.csdn.net/moonlightpeng/article/details/131746994