I was coding and figuring out speeds in unity then this error came up and said something about the backwards speed, and I don’t see any problems with it… could any one of you guys help me with thisk, I have been looking on this for hours so if anyone could take some time and help me that would be great! ![]()
Here is the error and down below that is my code (it is JavaScript! :)):
MissingFieldException: CharacterMotorMovement.maxbackwardsSpeed
Boo.Lang.Runtime.DynamicDispatching.PropertyDispatcherFactory.FindExtension (IEnumerable`1 candidates)
Boo.Lang.Runtime.DynamicDispatching.PropertyDispatcherFactory.Create (SetOrGet gos)
Boo.Lang.Runtime.DynamicDispatching.PropertyDispatcherFactory.CreateSetter ()
Boo.Lang.Runtime.RuntimeServices.DoCreatePropSetDispatcher (System.Object target, System.Type type, System.String name, System.Object value)
Boo.Lang.Runtime.RuntimeServices.CreatePropSetDispatcher (System.Object target, System.String name, System.Object value)
Boo.Lang.Runtime.RuntimeServices+c__AnonStorey18.<>m__D ()
//My CODE!!
var PlayerState : float;
var PlayerAnimations : GameObject;
var PlayerMotor : CharacterMotor;
var WalkingSpeed : float = 6; // The walking speed.
var SprintingSpped : float = 10; // The sprinting speed.
function Update ()
{
PlayerStateController();
PlayerAnims();
}
function PlayerStateController()
{
if((Input.GetAxis(“Vertical”) !=0 || Input.GetAxis(“Horizontal”) !=0))
{
if (Input.GetButton(“sprint”))
{
PlayerState = 2;
}
else
{
PlayerState = 1;
}
}
else
{
PlayerState = 0;
}
} //End PlayerStateController.
function PlayerAnims()
{
if (PlayerState == 0)
{ // you can say animation.play to see a diffrence
PlayerAnimations.animation.CrossFade(“IdleBarrettm85”, 0.4); //Smothness is 0.4 so that the transactin between the two are smotthend
}
else if (PlayerState == 1)
{
PlayerAnimations.animation.CrossFade(“WalkBarrettm85”, 0.4); //Smothness is 0.4
PlayerMotor.movement.maxForwardSpeed = WalkingSpeed; //max forward walking speed (!!as the variable above!!)
PlayerMotor.movement.maxSidewaysSpeed = WalkingSpeed/2; //max sideways walking speed (!!as the variable above divided by two!!)
PlayerMotor.movement.maxbackwardsSpeed = WalkingSpeed; //max backwards walking speed (!!as the variable above!!)
}
else if (PlayerState == 2)
{
PlayerAnimations.animation.CrossFade(“SprintBarrettm85”, 0.4); //Smothness is 0.4
PlayerMotor.movement.maxForwardSpeed = SprintingSpped; //max forward sprinting speed (!!as the variable above!!)
PlayerMotor.movement.maxSidewaysSpeed = SprintingSpped/2; //max sideways sprinting speed (!!as the variable above divided by two!!)
PlayerMotor.movement.maxbackwardsSpeed = SprintingSpped; //max backwards sprinting speed (!!as the variable above!!)
}
}
please format your code please read the faq and/or view the video tutorial available on the right-hand side of most pages
– Loius