Skip to content

Instantly share code, notes, and snippets.

@uzzu
Last active December 26, 2015 09:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uzzu/7130449 to your computer and use it in GitHub Desktop.
Save uzzu/7130449 to your computer and use it in GitHub Desktop.

単純なJIT領域の例
肝となるのはFoo<T>#Log()内の、t.ToString();なところ 例えばこれをtにしたとしても、UnityEngine::Debug::Log()の実装が

using System;
public static void Log(object message)
{
  Debug.Internal_Log(0, (message == null) ? "Null" : message.ToString(), null);
}

となっているため、まあ同じことになる

using UnityEngine;
public class Foo<T>
{
T t;
public Hoge(T t)
{
this.t = t;
}
public void Log()
{
UnityEngine.Debug.Log(t.ToString());
}
}
public class FooEx : Foo<string>
{
public FooEx(string message) : base(message)
{
}
}
using UnityEngine;
public class Main : MonoBehaviour
{
private void Start()
{
var foo = new FooEx("foo");
foo.Log();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment