public static void ToNative(IntPtr nativeBuffer, int arrayIndex, UnrealObject owner, string obj) { unsafe { UnrealInterop.MarshalToUnrealString(obj, nativeBuffer + arrayIndex * Marshal.SizeOf(typeof(ScriptArray))); } }
public static string FromNative(IntPtr nativeBuffer, int arrayIndex, UnrealObject owner) { unsafe { ScriptArray *ustring = (ScriptArray *)(nativeBuffer + arrayIndex * Marshal.SizeOf(typeof(ScriptArray))); return(UnrealInterop.MarshalIntPtrAsString(ustring->Data)); } }
public SubclassOf(Type klass) { if (klass == typeof(T) || klass.IsSubclassOf(typeof(T))) { NativeClassPtr = UnrealInterop.GetNativeClassFromType(klass); } else { throw new ArgumentException(String.Format("{0} is not a subclass of {1}.", klass.Name, typeof(T).Name)); } }
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))); } } }
static Key() { IntPtr nativeStructPtr = UnrealInterop.GetNativeStructFromName("Key"); NativeDataSize = UnrealInterop.GetNativeStructSize(nativeStructPtr); }