原文地址:https://support.unity3d.com/hc/en-us/articles/206529603-What-is-CS0200-
症状
当尝试进入Play模式时,我得到了如下错误:
error CS0200: Property or indexer `__’ cannot be assigned to (it is read only)
原因
当尝试给一个只能读取而不能改变的变量赋值时,就会发生CS0200号错误。
本例子的错误信息如下:
error CS0200: Property or indexer `UnityEngine.GameObject.activeSelf’ cannot be assigned to (it is read only)
解决方案
想要修复CS0200号错误,你需要找到另一种替代方法来达成想要的结果。本例中,我们拥有一个方法可以允许我们设置GameObject为激活状态。
更多信息
https://msdn.microsoft.com/en-us/library/fd8axwct(v=vs.90).aspx