Group Group Group Group Group Group Group Group Group

Character not moving in Unity, Bobblehead Wars tutorial


Reddit assisted with some script errors that I made. I redid the script and the error is gone, allowing me to “play”. Now my character is not moving. I double checked input keys and rigidbody settings. Would this issue still be in the script?

This is the last section of tutorial for recreating Bobblehead Wars, would like to understand the issue as much as possible before proceeding to anything else. Thanks!

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

public class PlayerController : MonoBehaviour {
public float moveSpeed = 50.0f;

// Use this for initialization
void Start () {

// Update is called once per frame
void Update () {
    Vector3 pos = transform.position;
    pos.x += moveSpeed * Input.GetAxis("Horizontal") * Time.deltaTime;
    pos.z += moveSpeed * Input.GetAxis("Vertical") * Time.deltaTime;




I think you forgot to set the position again after changing it in the Update method.
Try adding this:

transform.position = pos;


pos.z += moveSpeed * Input.GetAxis("Vertical") * Time.deltaTime;


closed #3

This topic was automatically closed after 166 days. New replies are no longer allowed.