Does code in Unity run in order? In the game, my start() function has showMenu();, then below the implementation for showMenu(); is the function that gets input.
I do not understand the input function either; it’s not like std::cin >> input, the function OnUserInput(string input) just takes a parameter then outputs that parameter.
For me, OnUserInput runs before showMenu, yet the menu appears on screen without it being called inside of start().
public class HackerMode : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
showMenu();
}
void OnUserInput(string input)
{
print(input);
}
void showMenu()
{
print("Terminal started, outputting menu text.");
Terminal.ClearScreen();
Terminal.WriteLine("Hello.");
Terminal.WriteLine("Welcome to the anagram hacker module\nThree difficulties exist\n");
Terminal.WriteLine("Type 1 for easy difficulty. \nType 2 for medium difficulty\nType 3 for hard difficulty");
}
}
Within the above code, given that OnUserInput(); is never explicitly called, am I to expect that every function with implementation will run regardless of whether or not I call it inside of start();? How does the order of execution work? Is the class the equivalent of int main() in c++, or what?