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 navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
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