2015-07-01から1ヶ月間の記事一覧
ソースコード 使い方 AssertUtils.IsNull( obj1, obj2 ); AssertUtils.IsNull( obj1, obj2, obj3 ); AssertUtils.IsNull( obj1, obj2, obj3, obj4 ); AssertUtils.IsNull( obj1, obj2, "null ではないオブジェクトが存在します" ); AssertUtils.IsNull( obj1…
ソースコード using System; using System.Collections.Generic; public static class IEnumerableExtensions { public static bool None<TSource>( this IEnumerable<TSource> source, Func<TSource, bool> predicate ) { foreach ( var n in source ) { if ( predicate( n ) ) { return fals</tsource,></tsource></tsource>…
ソースコード public static class StringUtils { private const string PASSWORD_CHARS = "0123456789abcdefghijklmnopqrstuvwxyz"; public static string GeneratePassword( int length ) { var sb = new System.Text.StringBuilder( length ); var r = ne…
using UnityEngine; public class Player : MonoBehaviour { private int mValue = Random.Range( 0, 10 ); } このように変数初期化子でRandom.Range関数を使用すると 下記のようなエラーが発生します RandomRangeInt can only be called from the main thre…
概要 Tupleクラスは .NET Framework 4.0 から追加されたため .NET Framework 3.5 までの機能しか使えないUnityでは使用できません そのため、Unity でTupleを使用したい場合は 自前で実装する必要がありますが 個人的には Gist で公開されている下記のソース…
ソースコード 使い方 var character = gameObject.GetComponent<Character>(); // 従来の方法 GameObject.Destroy( character ); // 拡張メソッドの方法 character.Destroy(); 関連記事</character>
Asset Store 概要 クラッシュ・オブ・クランのような街作りゲームのスターターキット クラッシュ・オブ・クラン (Clash of Clans)Supercellゲーム無料 公式サイト http://www.citybuildingkit.com/ パッケージ種別 サンプルアプリ シティービルダー https://…
期待した処理が呼び出されない Action onLog = null; Action onClick = null; onClick += onLog; onLog += () => Debug.Log( "ピカチュウ" ); onClick(); Debug.Log( "ピカチュウ" )は呼び出されない onClickにonLogを登録したタイミングでonLogはnullのため…
using UnityEngine; public class Player : MonoBehaviour { public Enemy mEnemy; } using UnityEngine; public class Enemy : MonoBehaviour { } 例えば上記のようなスクリプトが存在して それぞれをゲームオブジェクトにアタッチして参照を設定していたと…