Skip to content

Instantly share code, notes, and snippets.

View xVir's full-sized avatar

Danil Skachkov xVir

  • Google
  • Santa Clara
View GitHub Profile
@xVir
xVir / unity_codegen.md
Created March 12, 2015 12:05
Unity and codegeneration

While working on Unity plugin project I need to map JSON to the C# objects. For this task I used modification of the fastJSON library. But fastJSON use codegeneration for creating special methods for reading/writing object properties. It looks like:

il.Emit(OpCodes.Ldarg_0);
il.Emit(OpCodes.Ldarg_1);
if (fieldInfo.FieldType.IsValueType)
 il.Emit(OpCodes.Unbox_Any, fieldInfo.FieldType);
@xVir
xVir / unity_android_problem.md
Last active August 29, 2015 14:16
Unity compilation and Android

Problems with Unity app compilation

While development of our API.AI Unity SDK I have faced with upset thing. When trying to build sample Unity app for iOS platform build ends with error:

Cross compilation job ApiAiSDK.Unity.dll failed.
UnityEngine.UnityException: Failed AOT cross compiler: /Applications/Unity/Unity.app/Contents/PlaybackEngines/iOSSupport/Tools/OSX/mono-xcompiler --aot=full,asmonly,nodebug,static,outfile="ApiAiSDK.Unity.dll.s" "ApiAiSDK.Unity.dll" 

First I thought, that this situation is caused by external dll's, linked to the ApiAiSDK.Unity.dll library. Googling did not lead to anything useful... So I tried to check my external libraries, and run mono-xcompiler manually. mono-xcompiler compiles .NET Assembly to the native iOS code.

@xVir
xVir / MultipartHttpClient.cs
Created February 5, 2015 10:40
Send multipart request with HttpWebRequest
using System;
using System.Collections;
using System.Net;
using System.IO;
using System.Text;
public class MultipartHttpClient
{
private const string delimiter = "--";