- Home /
Question by
Mokatte · May 07, 2014 at 03:34 PM ·
c#charactercontroller
Unity can't find Character Motor and max forwad speed
Hello,
My problem is easy :
Im creating in first person controler, sprint. That's the code :
using UnityEngine; using System.Collections;
public class Gracz : MonoBehaviour {
void Update ()
{
if (Input.GetKey (KeyCode.W))
{
gameObject.GetComponent<CharacterMotor>().movement.maxForwardSpeed = 6;
}
if (Input.GetKey (KeyCode.W) & Input.GetKey(KeyCode.LeftShift))
{
GameObject.GetComponent<CharacterMotor>().movement.maxForwardSpeed = 50;
}
}
}
Unity is illuminating on red color : "CharacterMotor", "movement" and "maxForwardSpeed". Im creating it in C#. I think that there can be problem, that CharacterMotor is in JavaScript, but I really can't change my program to Java, becouse I got really good tutorial in C#. Sorry for my bad english.
Comment
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
How can I add Character Controller to my script? 0 Answers
super messed up speed 1 Answer
Using isGrounded with a RigidBody 2 Answers