Doing an Update Function only once

Hey Guys

I am having the following problem: I want to be able to spawn my plane in the air and let it land automatically using the defined path. After I should be able to use the ground commands again and to drive around on the airport area. My problem is now: If the plane is landed through the script, i can move it around but it allways gets pulled back to the Gizmo. I would like it to be released from the path script as soon as i have pressed the “up Arrow once”, but how to set this up?:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PathFollower : MonoBehaviour {

public Transform[] path;
public float speed = 5.0f;
public float reachDist = 1.0f;
public int currentPoint = 0;

void Start(){


void Update(){

	Vector3 dir = path [currentPoint].position - transform.position;

	transform.position += dir * Time.deltaTime * speed;

void OnDrawGizmos (){

	if (path.Length > 0)

	for (int i = 0; i < path.Length; i++) {

		if (path  *!= null) {*

_ Gizmos.DrawSphere (path .position, reachDist);_
* }*
* }*
* }*

You could disable the script once you’ve finished with the update function by setting “this.enabled = false”, and move your ground movement to another script.

If you need to run functions other than Update, you can always perform some kind of check to see if it’s on the ground, like a boolean, and use an if statement to simply bypass the Update code.

Alternatively, you can put your code in a delegate and run the delegate in the Update function instead, and once you no longer need the Update code you assign the delete over to another function to run instead.