I previously asked this question, but the topic was closed and marked as answered before I could get clarification on an answer.
Here’s the original question:
I am using Unity 2019.3.13f1 and the Archived Complete C# Unity Game Developer 3D course on Udemy. Since I am using the Archived course, I can’t use the Q&A.
I've got an error in Unity,
I’m not sure how to fix this problem. Could someone help me?
(Original question end)
The answer I got told me to check the lines of code the error referred to and to check the Lecture’s Project Changes. I did both of these, to no avail. I saw no differences between my code and the Project Changes, but something may have slipped my notice. Here’s my code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Hacker : MonoBehaviour
{
// Game config. Data
string[] level1Passwords = {"connection", "router", "watch", "play", "stream", "load" };
string[] level2Passwords = { "Masterpiece", "Borrow", "recive", "Checkout", "script", "character" };
//Game State
int level;
enum Screen { MainMenu, Password, Win };
Screen currentScreen;
string password;
// Start is called before the first frame update
void Start()
{
ShowMainMenu();
}
void ShowMainMenu()
{
Screen currentScreen = Screen.MainMenu;
Terminal.ClearScreen();
Terminal.WriteLine("What would you like to hack into?");
Terminal.WriteLine("Press 1 for the WIFI");
Terminal.WriteLine("Press 2 for the Library");
Terminal.WriteLine("Selection: ");
}
void OnUserInput(string input)
{
if (input == "menu")
{
ShowMainMenu();
}
else if (currentScreen == Screen.MainMenu)
{
RunMainMenu(input);
}
else if (currentScreen == Screen.Password)
{
CheckPassword(input);
}
}
void RunMainMenu(string input)
{
bool isValidLevelNumber = (input == "1" || input == "2");
if (isValidLevelNumber)
{
level = int.Parse(input);
StartGame();
}
else if (input == "pogchamp")
{
Terminal.WriteLine("You're my little pogchamp");
}
else
{
Terminal.WriteLine("Please choose a valid level");
}
}
void StartGame(int level)
{
currentScreen = Screen.Password;
Terminal.ClearScreen();
Terminal.WriteLine("Please enter your Password: ");
}
void CheckPassword(string input)
{
if (input == password)
{
Terminal.WriteLine("Access Granted");
}
else
{
Terminal.WriteLine("Wrong! Try again...");
}
}
}
Could someone please help me?

