A problem with Axis ...

Good day,

For a few days now I’ve been interested in game development and thus also in Unity. I watched a video on how to get around yesterday, but it doesn’t work, even though everything is the same as in the video. I wrote the following code:

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

public class CubeMovement : MonoBehaviour
{ 
private float speed;

void Start()
{

}

void Update()
{
Vector3 movementVector = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));

transform.Translate(movementVector * Time.deltaTime * speed);

}

}

But nothing works in the Input Manager, everything is on the standard settings. By the way, I don’t get an error or anything like that. If I do it with “if” then it works … I hope someone can help me.

With best regards Carlo

At a glance it doesn’t look like you ever initialize your speed variable. Default is usually 0 so when you call transform.Translate you’re essentially saying to translate by Vector3.zero

I found a YouTube tutorial for this and the man did it that way.

Thank you!