Last active
January 29, 2024 19:05
-
-
Save xSystemIOx/e4af423f5a0d4136e4052695fbcd9b9c to your computer and use it in GitHub Desktop.
2D Character movement Left/Right script for C#
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class Move : MonoBehaviour { | |
private CharacterController player; | |
public float Speed; | |
void Start () { | |
player = GetComponent<CharacterController> (); | |
} | |
void Update () { | |
Vector3 Move = Vector3.zero; | |
Move.x = Input.GetAxis ("Horizontal") * Speed; | |
player.Move(Move * Time.deltaTime); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
i love this script i use it for my game undexruner great job making this script keep up the good work