(原)unity開發相關環境(vs、MonoDevelop)windows平台編碼問題


  情景描述:最近在做Unity的網絡底層,用VS編寫源碼,MonoDevelop用來Debug,在Flash Builder上搭建的Python做協議生成器,期間有無數次Unity莫名奇妙的的down掉了,然后仔細分析了一下:

1、unity會爆出錯誤:

  There are inconsistent line endings in the 'Assets/...cs' script. Some are Mac OS X (UNIX) and some are Windows.

  This might lead to incorrect line numbers in stacktraces and compiler errors. Unitron and other text editors can fix this using Convert Line Endings menu commands.

2、monoDevelop在保存更改時也會報出編碼錯誤:

  The file "E:\BillGameframe\unity\...Netmanager\Netmanager.cs" has line endings which differ from the policy settings.
  Do you want to convert the line endings?

  

3、然后用Notepad++的“顯示所有字符” 查看文件,發現VS保存的文件每行以‘CRLF’結尾(window平台文件),而MonoDevelop保存的是‘LF’結尾(Unix平台)

4、然后用Unity新建c#文件,發現為‘LF’結尾(Unix平台)

  解決方案:

1、將unity新建文件改為‘CRLF’

  將:C:\Program Files\Unity\Editor\Data\Resources\ScriptTemplates\下4個unity新建文件的模板改為‘CRLF’,

  修改方法:用VS打開,在文件-高級保存選項-行尾 選擇window(CRLF);

  

2、修改MonoDevelop環境編碼:

  修改方法:Project-Solution Option-Source Code-Code Formatting- 下3個文件格式的Line endings都改為Windows

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM