Skip to content

Instantly share code, notes, and snippets.

@hacha
hacha / Binding.cs
Created February 25, 2014 12:01
UnityのNativePluginで、Unity側のC#スクリプトからbyte配列を渡したり、プラグイン側からbyte配列を受け取る方法
using UnityEngine;
using System.Runtime.InteropServices;
using System.Text;
using System.IO;
using System;
public class Binding {
[DllImport("__Internal")]
private static extern bool Test(byte[] ptrSrc, int srcLength, ref IntPtr ptrDest, ref int destLength);
@hacha
hacha / gist:9188552
Created February 24, 2014 13:36
NSMutableDataに対して4byte長の数値データ出力って、こういうことでいいのかな?
NSMutableData *data = [[[NSMutableData alloc] initWithLength:0] autorelease];
int test = 1;
[data appendData:[NSData dataWithBytes:&test length:sizeof(test)]];