Menu_Script.cs 786 B

1234567891011121314151617181920212223242526272829303132
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.SceneManagement;
  5. public class Menu_Script : MonoBehaviour
  6. {
  7. public string nextSceneName;
  8. private GameObject scrollingText;
  9. // Start is called before the first frame update
  10. void Start()
  11. {
  12. scrollingText = GameObject.FindWithTag("ScrollingText");
  13. }
  14. // Update is called once per frame
  15. void Update()
  16. {
  17. if (scrollingText) {
  18. scrollingText.GetComponent<RectTransform>().localPosition = new Vector2(0, scrollingText.GetComponent<RectTransform>().localPosition.y + Time.deltaTime * 40f);
  19. }
  20. if (Input.GetKeyDown("space"))
  21. {
  22. if (nextSceneName != null) {
  23. SceneManager.LoadScene(nextSceneName);
  24. }
  25. }
  26. }
  27. }