備忘録

underscoreとlodashメモ

_.findはどちらにもあるけど、
_.findWhereと_.whereはunderscoreにしかない

_.filterか_.findで_.whereを代用する

社内の古いPCをGitリモートリポジトリにする

GitはほとんどBitbucketにリポジトリを作って使ってましたが、最近はデータが上限の2GBを大きく超えて4GBくらいになってきてて、プッシュしてもリジェクトされるので、社内の古いPCをGitのリモートリポジトリにして運用することにしたので、超簡単な手順をメモ。

Unity StreamingAssetsからファイルを読み出す

Streaming Assets で iOSとAndroidの違いにハマったのでメモ。

string FilePath;
#if UNITY_IPHONE
  FilePath = Application.dataPath + "/Raw/" + filename;
#else
  string fullPath = "jar:file://" + Application.dataPath + "/!/assets/" + filename;
  WWW www = new WWW (fullPath);
    while (!www.isDone) {
  }
  FilePath = Application.persistentDataPath + filename;
  File.WriteAllBytes (toPath,www.bytes);
#endif

iOSはそのままパスからファイル読み込みできるけど、Androidは一度Application.persistentDataPathにコピーしてから開かないといけない。