Skip to content

Instantly share code, notes, and snippets.

View anchan828's full-sized avatar

Keigo Ando anchan828

  • Unity Technologies
  • Japan
  • 14:18 (UTC +09:00)
  • X @kyusyukeigo
View GitHub Profile
using UnityEngine;
using System.Collections;
public class Example : MonoBehaviour
{
void Start ()
{
MaterialPropertyBlock mpb = new MaterialPropertyBlock ();
//赤色の情報を加える
mpb.AddColor ("_Color", Color.red);
using UnityEngine;
using System.Collections;
public class Example : MonoBehaviour
{
long time = 5000;
void Start ()
{
AndroidJNI.AttachCurrentThread ();
@anchan828
anchan828 / gist:2592717
Created May 4, 2012 06:57
NaClのpostMessageをWebPlayerのSendMessageっぽく
function GetUnity() {
return document.getElementById("UnityEmbed")
}
function SendMessage(name, method, parameter) {
GetUnity().postMessage(name + "." + method + "(" + parameter + ")")
}
Vector2 v2;
void OnGUI ()
{
v2 = EditorGUILayout.Vector2Field ("", v2);
EditorGUIUtility.SetIconSize (v2);
Debug.Log (EditorGUIUtility.GetIconSize ());
tex = (Texture2D)EditorGUI.ObjectField (new Rect (0, 50, 100, 100), tex, typeof(Texture2D));
GUI.Label (new Rect (0, 150, 100, 30), EditorGUIUtility.ObjectContent (tex, typeof(Texture2D)));
Instance ID: 2 Object's name: VertexLit
Instance ID: 4 Object's name: Legacy Shaders/Diffuse Fast
Instance ID: 6 Object's name: Diffuse
Instance ID: 8 Object's name: Bumped Diffuse
Instance ID: 10 Object's name: Specular
Instance ID: 12 Object's name: Bumped Specular
Instance ID: 14 Object's name: Diffuse Detail
Instance ID: 16 Object's name: Self-Illumin/VertexLit
Instance ID: 18 Object's name: Self-Illumin/Diffuse
Instance ID: 20 Object's name: Self-Illumin/Bumped Diffuse
private Rect rect1, rect2;
private bool stats, gizmos, on;
void OnGUI (){
on = EditorGUILayout.Toggle (on);
rect1 = EditorGUILayout.RectField (rect1);
rect2 = new Rect (0, 22, position.width, position.height);
stats = EditorGUILayout.Toggle ("stats :", stats);
gizmos = EditorGUILayout.Toggle ("gizmos :", gizmos);
using UnityEngine;
using UnityEditor;
public class RenderGameViewCamerasScript : EditorWindow
{
[MenuItem("EditorGUIUtility/RenderGameViewCameras")]
static void OpenWindow ()
{
RenderGameViewCamerasScript window = GetWindow<RenderGameViewCamerasScript> ();
window.position = new Rect (50, 50, 500, 500);
MacBook Pro
13-inch, Early 2011
プロセッサ 2.3 GHz Intel Core i5
メモリ 8 GB 1333 MHz DDR3
グラフィックス Intel HD Graphics 3000 512 MB
ソフトウェア Mac OS X Lion 10.7.3(11D50d)
Parallels
バージョン: 7.0.15098.770637
using UnityEngine;
using UnityEditor;
public class Delay : Editor
{
[MenuItem("EditorApplication/StartDelayCall")]
static void StartDelay ()
{
EditorApplication.delayCall += CallMethod;
Debug.Log (EditorApplication.timeSinceStartup);
@anchan828
anchan828 / gist:3041253
Created July 3, 2012 17:31
FileReader使ってローカルのWebPlayer用unity3dファイル読み込む的な
$("#gameData :file").change(function (e) {
var file = e.target.files[0];
var reader = new FileReader();
reader.onload = function (load) {
var uni = load.target.result;
uni = uni.replace("data:base64", "data:application/vnd.unity;base64")
unityObject.embedUnity("unityPlayer",uni, 600,450);