X
X
xdefx2021-07-29 12:11:51
Unity
xdefx, 2021-07-29 12:11:51

Unity error in code, what to do?

Writes error Assets\Scripts\CharacterMechanics.cs(34,9): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement
Here is the code

using UnityEngine;

public class CharacterMechanics : MonoBehaviour
{
    //основные параметры
    public float speedMove;//скорость персонажа
    public float jumpPower;//сила прыжка

    //параметры геймплейя для персонажа
    private float gravityForce;//гравитация персонажа
    private Vector3 moveVector;//направление движения персонажа

    //ссылки на компоненты
    private CharacterController ch_controller;
    private Animator ch_animator;
    
    private void Start()
    {
        ch_controller = GetComponent<CharacterController>();
        ch_animator = GetComponent<Animator>();
    }

    private void Update()
    {
        CharacterMove();
    }

    //метод перемещения персонажа
    private void CharacterMove()
    {
        //перемещение по поверхности
        moveVector = Vector3.zero;
        moveVector.x - Input.GetAxis("Horizontal") * speedMove;
        moveVector.z - Input.GetAxis("Vertical") * speedMove;


        ch_controller.Move(moveVector * Time.deltaTime);//метод передвижения по направлению
    }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GavriKos, 2021-07-29
@xdefx

what to do?

learn seasharp

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question