Skip to content

Instantly share code, notes, and snippets.

@tsubaki
tsubaki / InfomationMonitor
Last active Aug 11, 2017
ユーザーが登録した情報を表示 情報を更新すると一覧も更新
View InfomationMonitor
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class InfomationMonitor : SingletonMonoBehaviour<InfomationMonitor> {
public Dictionary<string, string> param = new Dictionary<string, string>();
private static bool monitorEnable = false;
View LoadTexture.cs
using UnityEngine;
using System.Collections;
using System.IO;
public class LoadTexture : MonoBehaviour {
[SerializeField] string fileName = "icon";
[SerializeField] GUITexture gui;
@tsubaki
tsubaki / DelegateSample.cs
Last active Dec 13, 2015
デリゲートの例
View DelegateSample.cs
delegate void DownloadAction(WWW www);
public Texture mainTexture;
void Start()
{
StartCoroutine(DownloadAndAction(urls[0], SetMainTexture));
}
void SetMainTexture(WWW www )
@tsubaki
tsubaki / lambda_sample.cs
Last active Dec 13, 2015
ラムダ式サンプルその1
View lambda_sample.cs
void Awake()
{
Function( err =>{ Debug.Log(err); }); // 1
Function( DebugLog ); // 2
}
// 1と2に必要
delegate void ErrorMessage(string str);
void Function(ErrorMessage err)
{
@tsubaki
tsubaki / GetActiveObject.cs
Created Feb 18, 2013
ラムダ式の例その2 アクティブなオブジェクトを取得する
View GetActiveObject.cs
List<GameObject>activeObjects = objs.FindAll( (obj) => obj.activeSelf == true );
@tsubaki
tsubaki / Lambda_Test2.cs
Last active Dec 13, 2015
ラムダ式の例その3
View Lambda_Test2.cs
public Texture mainTexture;
delegate void DownloadAction(WWW www);
void Start ()
{
StartCoroutine(DownloadAndAction(textureUrl, (www)=>
{
mainTexture = www.texture;
}));
}
@tsubaki
tsubaki / DrawMeshOnSceneview.cs
Created Mar 12, 2013
DrawMeshをシーンビューで表示
View DrawMeshOnSceneview.cs
using UnityEngine;
using System.Collections;
#if UNITY_EDITOR
using UnityEditor;
#endif
[ExecuteInEditMode]
public class DrawMeshOnSceneview : MonoBehaviour {
@tsubaki
tsubaki / ScriptableObjectToAsset.cs
Last active Mar 22, 2019
ScriptableObjectをAssetsファイルとして出力する汎用スクリプト
View ScriptableObjectToAsset.cs
using UnityEngine;
using System.Collections;
using UnityEditor;
using System.IO;
/// <summary>
// ScriptableObjectをプレハブとして出力する汎用スクリプト
/// </summary>
// <remarks>
// 指定したScriptableObjectをプレハブに変換する。
View TransformEditorWith2D.cs
using UnityEngine;
using System.Collections;
using UnityEditor;
[CustomEditor(typeof(Transform))]
public class TransformEditorWith2D : Editor
{
public override void OnInspectorGUI ()
{
Transform t = target as Transform;
@tsubaki
tsubaki / AudioFade.cs
Created Apr 28, 2013
サウンドをフェードアウト/フェードインするサンプル
View AudioFade.cs
using UnityEngine;
using System.Collections;
using System;
[RequireComponent( typeof(AudioSource))]
public class AudioFade : MonoBehaviour
{
int volume = 0;
You can’t perform that action at this time.