LoginSignup
4
4

More than 5 years have passed since last update.

[AWS] Unity5.3 で AWS Mobile SDK for Unityをインポートした際に出るエラーを修正する

Posted at

こないだ

2週間くらい前にUnity5.3がreleaseされました。

早速アップデートしてAWS Mobile SDK for Unityを使ってみようと思ったらワーニングとエラーが出ました :disappointed_relieved:

というわけで、修正方法を調べました

環境

環境は、OSX(10.11.2)Unity5.3.04faws-unity-sdk-2.1.0.0です。
インポートしたパッケージは、aws-sdk-unity-lambda-2.1.0.0.unitypackageです。

sdkのインポート

aws-sdkのインポートは省略します。詳しくはこちらから。

Unity consoleでのエラー

わらわらと、こんな感じ。
Screen Shot 2015-12-21 at 23.11.38.png

対応する

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。

Screen Shot 2015-12-22 at 11.04.00.png

Error

次にErrorは4つ出ているけど、同じ内容なので抜粋。要約するとILoggerLoggerなどが、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.LoggerAmazon.Runtime.Internal.Util.Loggerは実装が違うので、呼び出し元を確認した。

どうやらAmazon.Runtime.Internal.Util.をエラー箇所に追加すればOKみたい。

consoleからErrorをクリックすると、MonoDevelop-Unityが立ち上がってエラー箇所に飛べるので、そこで修正すればOK。

再度Warning

またなんかでた。InvalidDataExceptionの名前がかぶっているらしい。

Screen Shot 2015-12-22 at 13.49.27.png

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 でクラス名を変更してしまう。

Screen Shot 2015-12-22 at 14.57.00.png

これで

すっきり。
Screen Shot 2015-12-22 at 12.57.14.png


[参考]

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4