a while back i made an RTS camera system albeit a simple one, its worked perfectly up until the latest unity update version 5.1.1f1, all but one segment of code works but its important to its functionality here is the code what is wrong with this
using UnityEngine;
using System.Collections;
public class cameramovement : MonoBehaviour
{
public int edgeboundry = 10;
public int minheight;
public int maxheight;
bool minheightreached;
bool maxheightreached;
void Awake ()
{
minheightreached = false;
maxheightreached = false;
}
void Update ()
{
if (transform.position.y >= minheight) {
minheightreached = true;
}
if (transform.position.y <= maxheight) {
maxheightreached = true;
}
if (Input.GetKey ("left ctrl") && (Input.mousePosition.y < Screen.height / edgeboundry) || (Input.GetAxis ("Vertical") < 0 * Time.deltaTime)) {
transform.position += new Vector3 (0, 0, -0.2f);
}
if (Input.GetKey ("left ctrl") && (Input.mousePosition.y > Screen.height - Screen.height / edgeboundry) || (Input.GetAxis ("Vertical") > 0 * Time.deltaTime)) {
transform.position += new Vector3 (0, 0, 0.2f);
}
if (Input.GetKey ("left ctrl") && (Input.mousePosition.x < Screen.width / edgeboundry) || (Input.GetAxis ("Horizontal") < 0 * Time.deltaTime)) {
transform.position += new Vector3 (-0.2f, 0, 0);
}
if (Input.GetKey ("left ctrl") && (Input.mousePosition.x > Screen.width - Screen.width / edgeboundry) || (Input.GetAxis ("Horizontal") > 0 * Time.deltaTime)) {
transform.position += new Vector3 (0.2f, 0, 0);
}
if (Input.GetAxis ("Ymovement") < 0 && (minheightreached = false)) { //this is the offending segment
transform.position += new Vector3 (0, 0.2f, 0);
}
if (Input.GetAxis ("Ymovement") > 0 && (maxheightreached = false)) { //this is the offending segment
transform.position += new Vector3 (0, -0.2f, 0);
}
}
}
the segment stated controls up and down movement on the Y axis as stated all the rest do their intended job but the marked bit don’t
i would also like to explane that the code itself is on a gameobject with the camera parented to it and its the gameobject that is raising and lowering, in the inspector the minheight variable is set to 4 and the maxheight variable is set to 40 p.s the ymovement input is also set correctly in the input section of the edit menu
thanks in advance to everyone that helps