私は作ったソフトのソースをSourceTreeを使ってgitで管理しています。これまで特に問題なく使えていたのですが、あるunityのプロジェクトをcommit してcloneしたところ、cloneしたプロジェクトを開くとこんなエラーが大量に・・
あとWindowsでのフォルダ構成の比較方法。
Assets\Plugins\UnityChannel\XiaomiSupport\AppStoreSettings.cs(7,19): error CS0234: The type or namespace name 'Store' does not exist in the namespace 'UnityEngine' (are you missing an assembly reference?) Assets\Plugins\UnityPurchasing\script\IAPDemo.cs(20,19): error CS0234: The type or namespace name 'Store' does not exist in the namespace 'UnityEngine' (are you missing an assembly reference?) Assets\Plugins\UnityPurchasing\script\CodelessIAPStoreListener.cs(21,19): error CS0246: The type or namespace name 'ProductCatalog' could not be found (are you missing a using directive or an assembly reference?) Assets\Plugins\UnityPurchasing\script\IAPConfigurationHelper.cs(12,91): error CS0246: The type or namespace name 'ProductCatalog' could not be found (are you missing a using directive or an assembly reference?)
これはUnityのIn App Purchaseを実装するために入れたpluginで出ています。単にpluginを入れてcommit/cloneしただけなんだけどな・・
でオリジナルのフォルダとcloneしたフォルダを比べてみると、IAP用のDLLが片っ端から抜けています。.gitignoreで除外指定してないはずなんだが・・とぐぐってみると、SourceTreeはgitignore_globalとhgignore_globalという,グローバルignoreリストを勝手に作るらしくて、その中に*.dllと*.libが入っているとのこと。なんとも迷惑な。
これらのファイルはwindowsだとC:\Users\user-name\Documentsの下にあります。そこから*dll. *libを削除して再度addするとちゃんと追加されて、上記のエラーもなくなりました。
自分で作ったdllがaddされないのならばすぐに気づいたかもしれませんが、今回はpluginのインストーラが自動で追加したファイルだったので気づきませんでいた。いやー良かった。
今回のトラブルのなかで、勉強になったサイト。
まずは今回のトラブルそのもののgitignore_globalとhgignore_globalについて説明されていたサイト
次にタイトルの通り.gitignoreに追加したのにファイルを無視してくれないときはキャッシュを削除すれば直ることを教えてくれたサイト。SourceTreeから実行する方法も記載されています。
あとWindowsでのフォルダ構成の比較方法。
コメント