Skip to content

Instantly share code, notes, and snippets.

View anchan828's full-sized avatar

Keigo Ando anchan828

  • Unity Technologies
  • Japan
  • 06:32 (UTC +09:00)
  • X @kyusyukeigo
View GitHub Profile
@anchan828
anchan828 / gist:3807207
Created September 30, 2012 15:39
WindowsでEditorPrefsを使うときにはBase64で保存する
using UnityEngine;
using UnityEditor;
using System.Text;
public class NewBehaviourScript{
[MenuItem("Window/Save")]
static void Save (){
EditorPrefs.SetString ("Hoge", ToBase64 ("日本語"));
}
using UnityEngine;
using System.Collections;
public class NewBehaviourScript : MonoBehaviour
{
public GUIStyle Btn;
void OnGUI ()
{
using UnityEngine;
public class Example : MonoBehaviour
{
static Example _instance;
void Awake ()
{
if (_instance != null) {
Destroy (gameObject);
using UnityEngine;
public class Test : MonoBehaviour
{
//targetB
private Plane plane;
public Transform targetA;
void Start ()
@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);
using UnityEngine;
using UnityEditor;
public class Delay : Editor
{
[MenuItem("EditorApplication/StartDelayCall")]
static void StartDelay ()
{
EditorApplication.delayCall += CallMethod;
Debug.Log (EditorApplication.timeSinceStartup);
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 RenderGameViewCamerasScript : EditorWindow
{
[MenuItem("EditorGUIUtility/RenderGameViewCameras")]
static void OpenWindow ()
{
RenderGameViewCamerasScript window = GetWindow<RenderGameViewCamerasScript> ();
window.position = new Rect (50, 50, 500, 500);
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);
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