private static extern string mainSort();
private static extern string testString();
I wrote a C++ plugin contains a very complicated function mainSort() and return a string while testString() is just return a "Hello" string. When I run it in Unity, the C# script get a valid return value first time while after the first time it works good, and if I change the return value into other type it works good too. And further more, if I call the testString() function before the mainSort() both function work perfectly, so I am totally confused about the reason. Any one meet this problem before? Or any solutions?
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users post good questions and use the site effectively we have posted a user guide.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
Answers and Comments
7 People are following this question.
How to pass string to a unity plugin?
using unity string plugin webcam
Return name of file only
Android Plugin return values non-string
Returning variables in a plugin