Skip to content

Instantly share code, notes, and snippets.

@hacha
hacha / FsmArraySetter.cs
Created February 8, 2022 11:36
PlayMakerのVariablesのArray<Texture>に、指定ディレクトリ以下のテクスチャアセットを一括セットするエディタスクリプト
#if PLAYMAKER
using System;
using System.Linq;
using HutongGames.PlayMaker;
using HutongGames.PlayMakerEditor;
using UnityEngine;
using UnityEditor;
public static class FsmArraySetter
{
@hacha
hacha / IOSBuildPostProcessor.cs
Created September 15, 2019 07:26
iOSビルド時にAssociatedDomainsを追加するエディタスクリプト
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;
using UnityEditor.iOS.Xcode;
public static class IOSBuildPostProcessor
{
[PostProcessBuild]
@hacha
hacha / CountUpStream.cs
Last active November 7, 2016 09:26
数値をカウントアップさせる時によくやる処理
using UnityEngine;
using System;
using UniRx;
using UniRx.Triggers;
public class CountUpStream
{
/// <summary>
/// カウントアップストリームの作成
/// </summary>
@hacha
hacha / gist:9ef45295e092564c84f68e84d00e3aff
Created September 19, 2016 07:43
2つのコルーチンの処理完了待ち合わせをUniRxを使って書いてみたもの
using UnityEngine;
using System.Collections;
using UniRx;
public class Foo : MonoBehaviour
{
IEnumerator Start ()
{
// 並列的に実行したい2つの処理があって、その両方が終わるまで待ち合わせをしたい。
Debug.Log("start");
@hacha
hacha / gist:5e1fc7b3cd8341ea8297
Created September 27, 2015 05:04
Androidでの謎のビルドエラー
2875: [Unity] Platform assembly: /UNITY_PATH/Unity/Unity-5_0_4f1/Unity.app/Contents/Frameworks/Managed/Unity.CecilTools.dll (this message is harmless)
2876: [Unity] Exception: ExtractAssemblyTypeInfo: Failed to process Library/ScriptAssemblies/Assembly-CSharp.dll, System.ArgumentException: An element with the same key already exists in the dictionary.
2877: [Unity] at Mono.Cecil.MetadataSystem.SetReverseNestedTypeMapping (UInt32 nested, UInt32 declaring) [0x00000] in <filename unknown>:0
2878: [Unity] at Mono.Cecil.MetadataReader.AddNestedMapping (UInt32 declaring, UInt32 nested) [0x00000] in <filename unknown>:0
2879: [Unity] at Mono.Cecil.MetadataReader.InitializeNestedTypes () [0x00000] in <filename unknown>:0
2880: [Unity] at Mono.Cecil.MetadataReader.InitializeTypeDefinitions () [0x00000] in <filename unknown>:0
2881: [Unity] at Mono.Cecil.MetadataReader.ReadTypes () [0x00000] in <filename unknown>:0
2882: [Unity] at Mono.Cecil.ModuleDefinition.<get_Types>b__8 (Mono.Cecil.ModuleDefinitio
@hacha
hacha / Debug.cs
Last active September 10, 2015 12:30
リリースビルド時にデバッグログ出力をしないようにするためのラッパー
#if ! UNITY_EDITOR
#define DEBUG_LOG_OVERWRAP
#endif
using UnityEngine;
#if DEBUG_LOG_OVERWRAP
public static class Debug
{
static public void Break()
@hacha
hacha / gist:8bfb174f9722492a83d1
Created July 7, 2015 09:23
こういうコンポーネントを持つオブジェクトを、ストリーム発火前にDestoryするとUniRx内でInvalidOperationExceptionが発生するっぽい
using UnityEngine;
using System.Collections;
using UniRx;
using UniRx.Triggers;
public class Test : MonoBehaviour
{
void Start ()
{
var key = this.UpdateAsObservable()
@hacha
hacha / gist:1460566d147056363aa5
Created June 28, 2015 06:55
GoogleAppEngineでPythonからSpreadSheetにアクセスしたい
ちょろっとしたことがやりたいだけなのに、やたらとつまづいているので一旦状況を整理する。
Python触るの初めてで、勝手の分からんからつまづいているんだと思う。
やりたいことは下記にあることまんま。
GoogleAppEngineでPythonからSpreadSheetにアクセスして、内容を読む。それだけ。
http://qiita.com/koyopro/items/d8d56f69f863f07e9378
自分が作業している環境
MacOS 10.10.3
Python 2.7.6
@hacha
hacha / Ball.cs
Last active August 29, 2015 14:16
生成されて10秒後に消滅するボール、みたいなものをUniRxで記述したもの
using UnityEngine;
using System;
using UniRx;
public class Ball : MonoBehaviour
{
void Awake ()
{
// var stream = Observable
// .EveryUpdate ()
@hacha
hacha / random.php
Created October 21, 2014 10:48
mt_srand()で同一のランダムシードを与えているのに、mt_rand()で同一の値が返らないタイミングがあるっぽい現象に遭遇したので、調査のためにラッパークラスを作成した。
<?php
class Random
{
private static $cnt;
public static function init($seed)
{
mt_srand($seed);
self::$cnt = 0;