Quantcast
Channel: Answers by "IvovdMarel"
Viewing all articles
Browse latest Browse all 145

Answer by IvovdMarel

$
0
0
If your level names are the same as the text in the input-field, it's as simple as: string levelName = inputField.text; SceneManager.LoadScene(levelName); Of course don't forget to add using UnityEngine.SceneManagement; at the top of your script. In case the input is not the same as your scene-name, you could create an if-else statement as follows: if (inputField.text == "1 2 3") { SceneManager.LoadScene ("level2"); } else if (inputField.text =="4 5 6") { SceneManager.LoadScene("level3"); } Remember to use { } in your if-statements. It's possible to work without them, but for a junior programmer I recommend to use them, as it makes it easier to understand your own structure.

Viewing all articles
Browse latest Browse all 145

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>