こないだ
2週間くらい前にUnity5.3がreleaseされました。
早速アップデートしてAWS Mobile SDK for Unityを使ってみようと思ったらワーニングとエラーが出ました
というわけで、修正方法を調べました。
環境
環境は、OSX(10.11.2)
、Unity5.3.04f
、aws-unity-sdk-2.1.0.0
です。
インポートしたパッケージは、aws-sdk-unity-lambda-2.1.0.0.unitypackage
です。
sdkのインポート
aws-sdkのインポートは省略します。詳しくはこちらから。
Unity consoleでのエラー
対応する
Warning
まず、Warningから。なにやら改行コードの問題らしい。
There are inconsistent line endings in the 'Assets/AWSSDK/src/Services/CognitoIdentity/Generated/Model/Internal/MarshallTransformations/GetIdResponseUnmarshaller.cs' script. Some are Mac OS X (UNIX) and some are Windows.
This might lead to incorrect line numbers in stacktraces and compiler errors. Many text editors can fix this using Convert Line Endings menu commands.
これは、MonoDevelop-Unityを開くと、以下のような確認がでるのでConvert all files to UNIX line endings
を選んでOK。
Error
次にErrorは4つ出ているけど、同じ内容なので抜粋。要約するとILogger
やLogger
などが、UnityEngine
なのかAmazon.Runtime.Internal.Util
を利用すればいいのかわからないという感じ。
Assets/AWSSDK/src/Core/Amazon.Runtime/Internal/Transform/_unity/UnityWebResponseData.cs(39,17): error CS0104: `ILogger' is an ambiguous reference between `UnityEngine.ILogger' and `Amazon.Runtime.Internal.Util.ILogger'
Assets/AWSSDK/src/Services/CognitoSync/Custom/SyncManager/_unity/Dataset.cs(92,17): error CS0104: `Logger' is an ambiguous reference between `Amazon.Runtime.Internal.Util.Logger' and `UnityEngine.Logger'
なので、ちゃんと名前空間を指定すれば行けるはず。
aws-sdk-unityでも同じようなIssueが上がっている。
UnityEngine.Logger
とAmazon.Runtime.Internal.Util.Logger
は実装が違うので、呼び出し元を確認した。
どうやらAmazon.Runtime.Internal.Util.
をエラー箇所に追加すればOKみたい。
consoleからErrorをクリックすると、MonoDevelop-Unityが立ち上がってエラー箇所に飛べるので、そこで修正すればOK。
再度Warning
またなんかでた。InvalidDataException
の名前がかぶっているらしい。
Warning CS0436: The type `System.IO.InvalidDataException' conflicts with the imported type of same name'. Ignoring the imported type definition (CS0436) (Assembly-CSharp)
とりあえず、クラス名を選択して、Refactor -> Rename でクラス名を変更してしまう。
これで
[参考]
UnityEngine.Loggerのリファレンス
http://docs.unity3d.com/ScriptReference/Logger.htmlAmazon.Runtime.Internal.Util.Logger
https://github.com/aws/aws-sdk-unity/blob/master/Assets/AWSSDK/src/Core/Amazon.Runtime/Internal/Util/Logger.cs