Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

unity move character

using UnityEngine;

public class PlayerMovement : MonoBehaviour
{
    [SerializeField] private float speed = 5.0f;

    private void Update()
    {
       var horizontal = Input.GetAxis("Horizontal");
       var vertical = Input.GetAxis("Vertical");
       transform.Translate(horizontal * (speed * Time.deltaTime), 0, vertical* (speed * Time.deltaTime));
    }
}
 
PREVIOUS NEXT
Tagged: #unity #move #character
ADD COMMENT
Topic
Name
1+4 =