Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Hey! I am new to coding and using unity and I would like some help in figuring out the problem

Discussion in 'Getting Started' started by Future3DXD, Nov 13, 2021.

  1. Future3DXD

    Future3DXD

    Joined:
    Nov 13, 2021
    Posts:
    1
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    public class PlayerController : MonoBehaviour
    {
    public Rigidbody rb;
    public float moveSpeed = 10f;
    // Start is called before the first frame update
    private float xInput;
    private float yInput;
    void Awake()
    {
    rb = GetComponent<Rigidbody>()
    }
    // Update is called once per frame
    void Update()
    {

    ProcessInputs();
    }
    private void FixedUpdate()
    {
    // Movement
    Move();''
    }
    private void ProcessInputs()
    {
    xInput = Input.GetAxis("Horizontal");
    yInput = Input.GetAxis("Vertical");
    }
    private void Move()
    {
    rb.AddForce(new Vector3(xInput, 0f, yInput) movespeed) * moveSpeed);
    }
     
  2. jbnlwilliams

    jbnlwilliams

    Joined:
    Sep 19, 2014
    Posts:
    3
    Well, it might be helpful if you :

    1. Use code tags when posting code. It is on the posting toolbar...next to the word code.
    2. You might want to , you know, actually tell us what the problem is.

    You actually have a few obvious problems, missing semi colon, missing comma and other syntax errors. but i will wait until you have a better post to respond to.