Menu
CoddyTech

Recap: Elevator

Part of the Unity Scripting Basics section of Coddy's Unity journey. Lesson 11 of 67.

challenge icon

Challenge

Easy

Write the elevator's script from scratch:

  • Two fields, speed and top, that the Inspector sets (it says 2 and 5) and no other script can change.
  • The elevator rises at speed units per second until its y reaches top, then stays there.

Press Play to watch it, then Check.

Try it yourself

using UnityEngine;

public class Lift : MonoBehaviour
{
    // speed and top: private, set in the Inspector

    void Update()
    {
    }
}

All lessons in Unity Scripting Basics