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

  

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值