Unity3d Запуск первой сцены

Череда сцен, которые меняются нажатием кнопки, как в последней сцене запустить все со старта?

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

public class player : MonoBehaviour
{
  [SerializeField] KeyCode keyOne;
  [SerializeField] KeyCode keyTwo;
  [SerializeField] Vector3 moveDirection;

  private void FixedUpdate()
  {
      if (Input.GetKey(keyOne))
      {
          GetComponent<Rigidbody>().velocity += moveDirection;

      }
      if (Input.GetKey(keyTwo))
      {
          GetComponent<Rigidbody>().velocity -= moveDirection;
      }
      if (Input.GetKey(KeyCode.R))
      {
          SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
      }
      if (Input.GetKey(KeyCode.Q))
      {
          SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
      }
      if (Input.GetKey(KeyCode.H)) 
      {
         **SceneManager.LoadScene("scene 1");**    // ???
      }
  }

  private void OnTriggerEnter(Collider other)
  { 
      if (this.CompareTag("Player") && other.CompareTag("Finish"))

      {
        SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
      }

      if(this.CompareTag("Cube") && other.CompareTag("Cube"))
      {
          foreach(Activator button in FindObjectsOfType<Activator>())
          {
              button.canPush = false;
          }

      }
  }
  private void OnTriggerExit(Collider other)
  {
      if (this.CompareTag("Cube") && other.CompareTag("Cube"))
      {
          foreach (Activator button in FindObjectsOfType<Activator>())
          {
              button.canPush = true;
          }

      }
  }



}

Как будет выглядеть оператор if, чтобы при нажатии запускалась сцена1. Спасибо.


Ответы (1 шт):

Автор решения: Максим Фисман

LoadScene принимает первым аргументов название или индекс целевой сцены. Чтобы включить первую, вы можете просто сделать

SceneManager.LoadScene(1);
→ Ссылка