C#スクリプトの改行コードにまつわるエラーの解決
参考書片手にC#スクリプトダブルクリックするとVisual Studio 2015が開いたからコード書いて動きの確認してしばらくしたら突然エラーが出た。
There are inconsistent line endings in the 'Assets/Scripts/RollObject.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.
参考にしたサイト
Unityの挿入する改行コードとVisual Studioで挿入されるCR+LFが混ざってエラーになった?っぽい。
やったこと
- Visual Studio 2015 -> Visual Stduio Community 2017に変更
無償環境さいこ^~
なんかインストールするときにTools for Unityって表示されてたからついでに入れた。
どうやらコード補完とかデバッグがしやすくなるらしい。
https://visualstudio.microsoft.com/ja/vs/features/game-development/?rr=http%3A%2F%2Funityvs.com%2F
- Unityで開くエディタの変更
Edit>Preference>External Tools>External EditorでBrowseからVS2017のexeを選択
- Line Endings Unifierインストール
VS2017メニュー>ツール>拡張機能と更新プログラムを選択して、オンラインタブを選択してVisual Studio MarketplaceからLine Endings UnifierをダウンロードぽちっとやったあとVS2017閉じたらVSIXインストーラが立ち上がった。ポチポチ押したらインストールされた。
その後VS2017メニュー>ツール>オプション>Line Endings Unifierで参考サイトの通り変えた。
Default Line EndingsをLinuxに変更
Force Default Line Endings On Document SaveをTrueに変更
これで様子をみてみることにする。