Hello,
I had a script working back in the old version of Unity but now I’m using Unity 5.5 and I can’t figure out how to get my script to work. All this code did was move an object forward at a constant rate.
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using System;
public class PlayerMover : MonoBehaviour {
public int speed;
public int fSpeed;
public int rSpeed;
Event onClick;
float buttonMove = 0;
void FixedUpdate()
{
MovePlayer (Input.GetAxis ("Horizontal"));
MovePlayer (buttonMove);
}
void MovePlayer(float horizontal)
{
float rotatePlayer = horizontal;
transform.Rotate(new Vector3(0, 0, rotatePlayer) * rSpeed);
Vector3 movement = new Vector3 (0.0f, 0.0f, fSpeed);
rigidbody.velocity = movement * speed;
}
public void StartMove(float horizontal)
{
buttonMove = horizontal;
}
}