C#如何访问对象的字段作为参考

时间:2017-08-16 12:27:39

标签: c# oop compiler-errors reference

我目前正在尝试使用Unity,我需要访问和修改另一个对象的公共文件。

ref int score = ref collision.collider.GetComponent<PlatformManager>().score;

然而,这给了我Assets/Scripts/PlatformBehaviour.cs(69,20): error CS1525: Unexpected symbol 'ref' and 'Assets/Scripts/PlatformBehaviour.cs(69,4): error CS1525: Unexpected symbol 'ref'

编辑:拼写错误

0 个答案:

没有答案