Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Limiting with UI ,slider??

Discussion in 'Scripting' started by Ericmatheus, Dec 19, 2014.

  1. Ericmatheus

    Ericmatheus

    Joined:
    Aug 11, 2014
    Posts:
    68
    I'm doing an aircraft game,and move with slider,i'm using this script to move

    using UnityEngine;
    using System.Collections;
    public class Move : MonoBehaviour {

    public float speed = 0.1f;
    void Start () {
    }
    // Update is called once per frame
    void Update () {
    transform.Translate (speed * Time.deltaTime,0,0);
    }

    public void AdjustSpeed (float newSpeed) {
    speed = newSpeed;

    }
    } The script above is attached on a slider how you can see on picture,if i change that slider the aircraft move,but how can i limit the movement??I don't know how to use UI system properly yet
    Thanks in advanced.
    X axis
     

    Attached Files:

    • gdf.jpg
      gdf.jpg
      File size:
      42.9 KB
      Views:
      728