Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Study for Unity that Charactor moving forward and back.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class UnityChan : MonoBehaviour {
public float speed = 1f;
Animator animator;
// Use this for initialization
void Start () {
animator = GetComponent<Animator>();
// Update is called once per frame
void Update () {
float h = Input.GetAxis("Horizontal");
animator.SetFloat("Speed", h);
// Vector3 v = Vector3.right * Time.deltaTime * h * speed;
Vector3 v = Vector3.forward * Time.deltaTime * h * speed;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment