Hello, I am new to unity. This c# code I watched it youtube tutorial for dynamic moment of object. But it stic to the position not moving a inch. Then I see console output for “float h = Input.GetAxis(“Horizontal”);” its display zero. What’s problem in my code.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Move : MonoBehaviour
{
// Start is called before the first frame update
public float speed = 5f;
void Start()
{
}
// Update is called once per frame
void Update()
{
float h = Input.GetAxis(“Horizontal”);
float v = Input.GetAxis(“Vertical”);
Debug.Log(h);
Vector2 pos = transform.position;
pos.x += speed*Time.deltaTime;
pos.y += speed * Time.deltaTime;
transform.position = pos;
}
}