Hello,
First of all my english is not the best because i’m from Germany.
I want to change the ‘MaxForwardSpeed’ Variable in the CharacterMotor Script coming with the First Person Character.
public float SprintSpeed = 0;
float CharSpeed;
void Start()
{
CharSpeed = GetComponent<CharacterMotor>().movement.maxForwardSpeed;
}
void Update()
{
}
I’ve tried it so many times in many different projects but i just won’t work, the error:
The name ‘CharacterMotor’ does not exists in the current context.
Can anyone help me? 
-
your code wouldn’t set the maxForwardSpeed, it retrieves the maxForwardSpeed
-
“The name ‘CharacterMotor’ does not exist in the current context” is saying that it doesn’t recognize the word ‘CharacterMotor’. This could happen for a number of reasons, for instance if CharacterMotor existed in another namespace… but it doesn’t, it should exist in the global namespace.
BUT
I do know that CharacterMotor is written in UnityScript and not C#. For one to access the other, the one being accessed must be compiled before the other as C# and UnityScript aren’t compiled together (I know, it’s really annoying).
Here is the compilation order:
CharacterMotor usually comes in the ‘Standard Assets’ folder if you import it through the package manager. Make sure that your script is NOT in the ‘Standard Assets’. This means the CharacterMotor will compile first, and your script after, and your script can access it then.