예제 #1
0
 public static void ToNative(IntPtr nativeBuffer, int arrayIndex, UnrealObject owner, string obj)
 {
     unsafe
     {
         UnrealInterop.MarshalToUnrealString(obj, nativeBuffer + arrayIndex * Marshal.SizeOf(typeof(ScriptArray)));
     }
 }
예제 #2
0
 public static void ToNative(IntPtr nativeBuffer, int arrayIndex, UnrealObject owner, string obj)
 {
     unsafe
     {
         if (owner != null)
         {
             //MarshalToUnrealString allocates memory meant to be freed by managed code
             //SetStringValue marshals the string in place over top the existing string.
             UnrealInterop.SetStringValue(nativeBuffer + arrayIndex * Marshal.SizeOf(typeof(ScriptArray)), obj);
         }
         else
         {
             // Allocate a new buffer for the string.  This marshaler still doesn't need to do any
             // cleanup on the managed side, but in the case where it's used for unowned memory,
             // the memory needs to have been allocated in a way where native code can clean it up.
             UnrealInterop.MarshalToUnrealString(obj, nativeBuffer + arrayIndex * Marshal.SizeOf(typeof(ScriptArray)));
         }
     }
 }