You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
396 B

  1. using UnityEngine;
  2. using System.Collections;
  3. public class maxHeight : MonoBehaviour {
  4. private float height;
  5. // Use this for initialization
  6. void Start () {
  7. height = transform.position.y;
  8. }
  9. // Update is called once per frame
  10. void FixedUpdate () {
  11. if (transform.position.y > height) {
  12. Vector3 pos = transform.position;
  13. pos.y = height;
  14. transform.position = pos;
  15. }
  16. }
  17. }