Skip to content

Instantly share code, notes, and snippets.

using System.IO;
using UnityEngine;
using UnityEditor;
namespace SetupTools
{
public class AbstractSettings<T> : ScriptableObject where T : ScriptableObject
{
public static T Load(string assetPath)
{
@iwashihead
iwashihead / RubyHashParser.cs
Created November 7, 2017 08:19
RubyのhashをC#のHashtableに変換するパーサ
using System;
using System.Collections;
using UnityEngine;
/// <summary>
/// =======================================================
/// RubyのhashをC#のHashTableに変換
/// =======================================================
///
@iwashihead
iwashihead / CommonTextAnimation.cs
Created October 20, 2017 01:23
UnityEngine.UI.Textにアタッチして文字を個別に動かすアニメーションのサンプル。
//-------------------------------------------------------
// @file CommonTextAnimation.cs
// @brief IMeshModifierを利用したテキストアニメーション.
//
// @author haruki.tachihara
//-------------------------------------------------------
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
@iwashihead
iwashihead / ForceDisplayUnityEventInScriptableObject.cs
Last active August 18, 2017 09:06
無理やりScriptableObjectのインスペクターにUnityEventを表示させる
[CustomEditor(typeof(Validator))]
public class ValidatorInspector : Editor
{
public override void OnInspectorGUI ()
{
var validator = target as Validator;
var width = EditorGUIUtility.currentViewWidth - 20;
var drawer = new UnityEventDrawer ();
if (GUILayout.Button ("Validate")) {
@iwashihead
iwashihead / HierarchyWindowExtension.cs
Created June 12, 2017 07:37
ヒエラルキーウインドウのソーティングレイヤーを表示する拡張
//-------------------------------------------------------
// @file HierarchyWindowExtension.cs
// @brief ヒエラルキービューの拡張.
//
// @author haruki.tachihara
//-------------------------------------------------------
using UnityEngine;
using UnityEditor;
/// <summary>
@iwashihead
iwashihead / RemoveAllMergedBranchs
Last active March 19, 2020 04:49
マージ済みのブランチをすべて削除するコマンド
git branch -D `git branch --merged | grep -v \* | xargs`
@iwashihead
iwashihead / SelectionHelper.cs
Created April 10, 2017 08:23
選択補助メニューアイテム
//-------------------------------------------------------
// @file SelectionHelper.cs
// @brief .
//
// @author haruki.tachihara
//-------------------------------------------------------
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@iwashihead
iwashihead / RubyText.cs
Created April 4, 2017 09:55
RichTextのようにタグ設定してルビを振るコンポーネント
using UnityEngine;
using System;
using System.Collections;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using System.Collections.Generic;
/// <summary>
/// ルビ付きテキスト.
/// "ふわふわ[時間:タイム]" のようにタグを設定することでルビが振られます
@iwashihead
iwashihead / CanvasGroupEnhansed.cs
Last active July 19, 2018 09:35
CanvasGroupのアルファを用いたフェード時にText用のメッシュエフェクトを綺麗に見せる
//-------------------------------------------------------
// @file CanvasGroupEnhansed.cs
// @brief
// CanvasGroupのアルファを用いたフェード時に
// Text用のメッシュエフェクトを綺麗に見せるコンポーネントです
// CanvasGroupにアタッチして使用してください
//
// @author haruki.tachihara
//-------------------------------------------------------
@iwashihead
iwashihead / NavMeshAreaSearch.cs
Created February 10, 2017 16:07
NavMeshAgentの位置しているNavMeshのエリア種類を取得する
using UnityEngine;
public class NavMeshAreaSearch
{
public NavMeshAgent NavMeshAgent;
void Hoge() {
// 現在乗っているNavMeshのエリアをPrintする
NavMeshHit navMeshHit;
if(NavMesh.SamplePosition(NavMeshAgent.transform.position, out navMeshHit, float.MaxValue, NavMesh.AllAreas)) {