Answer the question
In order to leave comments, you need to log in
What is wrong in the 45th and 12th line, Unity says that there is an error?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class playermovment : MonoBehaviour
{
public Rigidbody rb;
public float runSpeed = 500f;
public float strafeSpeed = 500f;
public float jumpForce = 15f;
protected bool strafeLeft = false;
protected bool strafeRight = false;
protected bool doJump = false;
void Update()
{
if (Input.GetKey("a"))
{
strafeLeft = true;
} else
{
strafeLeft = false;
}
if (Input.GetKey("d"))
{
strafeRight = true;
} else
{
strafeRight = false;
}
if (Input.GetKeyDown("space"))
{
doJump = true;
}
}
void FixadUpdate()
{
rb.Addforce(0, 0, runSpeed * Time.deltaTime);
}
}
Answer the question
In order to leave comments, you need to log in
Please post as code next time, + ideally a screenshot with an error. Recalculate the lines to guess where the error is not at all a thrill.
Error in function name. Should be AddForce
and you have a small f in the middle. Also, this logic will not be executed for you, because FixadUpdate
there should be an error in the function name. FixedUpdate
And if you install the free Visual Studio 2019 Community and select it as a tool for the code in the settings and regenerate the project files, then you will have these errors with tips on how to fix them.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question