Answers for "error CS1513: } expected"

0

how to fix error CS1513: } expected

}
		}
    }   
}
Posted by: Guest on July-01-2021
0

error CS1513: } expected

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class NewBehaviourScript : MonoBehaviour
{
    public float acceleration;
    public float maxSpeed;

    private Rigidbody rigidBody;
    private KeyCode[] inputKeys;
    private Vector3[] directionsForKeys;


    // Start is called before the first frame update
    void Start()
    {  inputKeys = new KeyCode[] { KeyCode.W, KeyCode.A, KeyCode.S, KeyCode.D };
   directionsForKeys = new Vector3[] { Vector3.forward, Vector3.left, Vector3.back, Vector3.right };
   rigidBody = GetComponent<Rigidbody>();
    }

    // Update is called once per frame
    // 1
   void FixedUpdate () {
   for (int i = 0; i < inputKeys.Length; i++)
    var key = inputKeys[i];

    // 2
    if(Input.GetKey(key)) {
      // 3
      Vector3 movement = directionsForKeys[i] * acceleration * Time.deltaTime;
      movePlayer(movement);
    }
    void movePlayer(Vector3 movement) {
   if(rigidBody.velocity.magnitude * acceleration > maxSpeed) {
    rigidBody.AddForce(movement * -1);
  } else {
    rigidBody.AddForce(movement);
  }
}
Posted by: Guest on September-21-2021
0

how to fix error CS1513: } expected

error CS1513: } expected
Posted by: Guest on July-01-2021
-1

how to fix error cs1513 in unity

cs1513
Posted by: Guest on November-22-2020

Code answers related to "error CS1513: } expected"

Browse Popular Code Answers by Language