【发布时间】:2020-09-11 05:13:26
【问题描述】:
目前我正在学习Unity,有点困惑。当我的导师想要访问另一个类的方法时(比如一个敌人想要在碰撞时访问玩家方法),他写了这样的东西:other.transform.GetComponents<Player>().Damage();
我的问题是:
-
他为什么要使用
other.transform,他不能只使用other.GetComponents<Player>().Damage(); -
Transform 和 GameObject 有什么区别?
【问题讨论】: