I am trying to run a simple script to get an object to move forward within unity.
My code is:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MoveToHold : MonoBehaviour {
private float traveledDistance;
public int moveSpeed = 10;
private bool isMoving;
public GameObject Aircraft;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (isMoving == true)
{
//Aircraft.transform.position += transform.forward * Time.deltaTime * moveSpeed;
Aircraft.transform.position += transform.forward * moveSpeed * Time.deltaTime;
}
}
public void move ()
{
isMoving = true;
Debug.Log(isMoving);
}
}
As far as I can see, the transform.position should work.
Any ideas?