When I start the game I get the message “Functioning Properly” and I’m not sure why… Debug Windows is set to clear on play too.
using UnityEngine;
using System.Collections;
public class SimpleMovement : MonoBehaviour {
public bool movingBackwards;
public Vector2 thrustBackward;
public Vector2 thrustForward;
public Vector2 thrustUp;
public Rigidbody2D rb2D;
void Start ()
{
movingBackwards = false;
thrustBackward = new Vector2 (-10, 0);
thrustForward = new Vector2 (10, 0);
thrustUp = new Vector2(0,4);
rb2D = GetComponent<Rigidbody2D> ();
}
void Backward ()
{
rb2D.AddForce(thrustBackward, ForceMode2D.Force);
}
void Forward ()
{
rb2D.AddForce(thrustForward, ForceMode2D.Force);
}
void Jump ()
{
rb2D.AddForce(thrustUp, ForceMode2D.Impulse);
}
void Update()
{
if (Input.GetKey(KeyCode.RightArrow))
Forward();
if(Input.GetKeyDown(KeyCode.Space))
Jump();
if(Input.GetKey(KeyCode.LeftArrow))
Backward();
movingBackwards = true;
if (movingBackwards == true)
Debug.Log ("Functioning Properly");
}
}