我有一个" FirstPersonController"我已经改名为#34; Player"。我想在播放器中设置变量:
Character Motor -> Movement -> Max Forward Speed
我已经尝试过如何做到这一点,而我最接近的就是:
var player : CharacterMotor;
player.movement.maxForwardSpeed = 12;
错误:
'movement' is not a member of 'UnityEngine.Component'.
我正在寻找的是更改此值的最简单方法是什么?
答案 0 :(得分:1)
尝试使用player
设置变量GetComponent(CharacterMotor);
,然后更改maxForwardSpeed
。像这样:
player = GetComponent(CharacterMotor);
player.movement.maxForwardSpeed = 12;