原文地址:https://support.unity3d.com/hc/en-us/articles/207515893-What-is-CS0664-
症状
当尝试进入Play模式时,我得到如下的错误:
error CS0664: Literal of type double cannot be implicitly converted to type `float’. Add suffix `f’ to create a literal of this type
原因
当声明一个float变量时,输入一个含有小数的数但却并不含“f”后缀时,将会引发CS0664号错误。请看下面的例子:
解决方案
通过添加“f”后缀到小数的末尾,就能解决CS0664错误。见下方例子: