Skip to content

Instantly share code, notes, and snippets.

View anchan828's full-sized avatar

Keigo Ando anchan828

  • Unity Technologies
  • Japan
  • 18:55 (UTC +09:00)
  • X @kyusyukeigo
View GitHub Profile
@anchan828
anchan828 / gist:5317953
Created April 5, 2013 09:29
Editor.CreateEditor の使い方その1
using UnityEngine;
using UnityEditor;
using System.Collections.Generic;
public class CloneInspecotr : EditorWindow
{
[MenuItem("Window/CloneInspecotr")]
static void Open ()
{
GetWindow<CloneInspecotr> ();
@anchan828
anchan828 / gist:5283436
Last active December 15, 2015 15:39
OnPreviewGUI
using UnityEngine;
using UnityEditor;
[CustomEditor(typeof(HogeScript))]
public class CompactWindow : Editor
{
private Editor model;
public override void OnInspectorGUI ()
{
HogeScript h = (HogeScript)target;
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Reflection;
public class HogeSearchableEditorWindow : SearchableEditorWindow
{
static SearchableEditorWindow window = null;
[MenuItem("Window/HogeSearchableEditorWindow #%p")]
@anchan828
anchan828 / gist:4697447
Created February 2, 2013 13:47
.assetファイル作成/保存ときのコード
public class Asset
{
public static void Save <T> (T asset) where T : ScriptableObject
{
Directory.CreateDirectory (DeployGateUtility.settingsFolderPath);
string assetPath = DeployGateUtility.settingsFolderPath + typeof(T).Name + ".asset";
T _asset = (T)AssetDatabase.LoadAssetAtPath (assetPath, typeof(T));
if (_asset == null)
AssetDatabase.CreateAsset (asset, assetPath);
AssetDatabase.SaveAssets ();
@anchan828
anchan828 / RichTextExtension.cs
Last active December 11, 2015 15:08
Small Middle Large は手動で変更する
/// <summary>
/// Unity RichText Extensions.
/// http://docs.unity3d.com/Documentation/Manual/StyledText.html
/// </summary>
namespace UnityExtensions.Text
{
public static class RichTextExtension
{
public static string Large (this string text)
{
@anchan828
anchan828 / gist:4567374
Last active December 11, 2015 07:38
Animatorで重力
using UnityEngine;
using System.Collections;
[RequireComponent(typeof(Animator))]
[RequireComponent(typeof(CharacterController))]
public class RobotController : MonoBehaviour
{
private Animator animator;
private CharacterController characterController;
@anchan828
anchan828 / C#
Created December 16, 2012 14:34
自分だけのPropertyDrawerを作ろう! ref: http://qiita.com/kyusyukeigo/items/8be4cdef97496a68a39d
using UnityEngine;
using System.Collections;
public class SampleScript : MonoBehaviour {
public float hp;
void Update()
{
Debug.Log( hp );
using UnityEngine;
/// <summary>
/// <para>通常使うスクリプトファイル。ゲームオブジェクトにアタッチすればインスペクターに表示される</para>
/// <para>今回は既にあるRangeAttributeを自作します。</para>
/// </summary>
public class Example : MonoBehaviour
{
/// <summary>
/// 0から10までしか設定することの出来ないスライダーを作成します。
/// <summary>
/// https://gist.github.com/4243887
/// http://anchan828.tumblr.com/post/37544410340
/// </summary>
using UnityEngine;
using UnityEditor;
using System.Linq;
using System.Collections.Generic;
using System;
@anchan828
anchan828 / gist:4218328
Created December 5, 2012 18:42
ログをブラウザのコンソールに出す WebPlayer用
using UnityEngine;
public class DebugLog : MonoBehaviour
{
void Awake ()
{
if (Debug.isDebugBuild)
Application.RegisterLogCallback (Handle);
}