Is it possible to send string data to a C plugin from Unity? If so what type should the C script be expecting?
Im currently using the following:
[DllImport ("__Internal")]
public static extern void ActivateTutorial( string description );
and the C Script:
extern 'C'
{
void ActivateTutorial( what magical type goes here? Im assuming char * );
}
I use “const char*” and then copy into local buffer.
So it looks something like this:
#define _BUF_SIZE 128
static char _description[ _BUF_SIZE ];
extern "C" void ActivateTutorial( const char* description )
{
strncpy( _description, description, _BUF_SIZE );
. . .
}
Hi
On the XCode side it might (don’t quote me on this) but it could be:
void ActivateTutorial( char * myString )
{
// do something with your string in here
}
or
void ActivateTutorial(const char * myString )
{
// do something with your string in here
}