Cannot convert void to float.(27, 17): error CS0029 Code (CSharp): public class PlayerController : MonoBehaviour { public float PlayerSpeed; public float PlayerJumpHeight; private float rotation; public int PlayerHealth; public bool IsFalling = true; private Rigidbody rb; // Use this for initialization void Start () { rb = GetComponent<Rigidbody> (); } // Update is called once per frame void Update () { rotation = rb.AddForce (new Vector3(Input.GetAxis("Horizontal"),0,0) * PlayerSpeed); rotation *= Time.deltaTime; rb.AddRelativeTorque (Vector3.back * rotation); if (Input.GetKeyDown(KeyCode.UpArrow) && IsFalling == false) { rb.velocity = new Vector3 (0, PlayerJumpHeight, 0); } } )
When you are calling rb.AddForce, what are you expecting to be returned? That method call doesn't return anything, it just does what you tell it (adds a force). https://docs.unity3d.com/ScriptReference/Rigidbody.AddForce.html