02-15-2017 08:40 AM
const char *roomIDString = ovr_Message_GetString(response);But we don't have this ovrID_FromString available anywhere in Unity, so I tried to create it like this in CAPI script :
ovrID roomID;
ovrID_FromString(&roomID, roomIDString));
// we can now try to join the room
[DllImport(DLL_NAME, CallingConvention=CallingConvention.Cdecl, EntryPoint= "ovrID_FromString")]I think the code doesn't work as expected since I receive a Message with IsError setted to true.
private static extern void ovrID_FromString(IntPtr retval, [MarshalAs(UnmanagedType.LPStr)] string str);
public static ulong IDFromString(string str)
{
IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(ulong)));
ovrID_FromString(ptr, str);
ulong retval = new ulong();
Marshal.StructureToPtr((object)retval, ptr, false);
Marshal.FreeHGlobal(ptr);
return retval;
}
02-15-2017 08:50 AM
02-20-2017 07:29 AM
[DllImport(DLL_NAME, CallingConvention=CallingConvention.Cdecl, EntryPoint= "ovrID_FromString")]
public static extern bool ovrID_FromString(out ulong retval, [MarshalAs(UnmanagedType.LPStr)] string str);
Works just fine 🙂
Turns out that it simply parses directly into a UInt32 ^^' (tested it earlier, but I had other issues...)
My problem is solved, sorry for this post