Terminal Hacker|Terminal Prefab having issues

I am having severe issues with the terminal not linking the various GameObjects correctly, and am not entirely sure how to correct it.

Thank you for your time.

Blockquote using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Hacker : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
ShowMainMenu();
print(“Hello” + “World”);
}
void ShowMainMenu()
{
Terminal.ClearScreen();
Terminal.WriteLine(“What would you like to hack into?”);
Terminal.WriteLine(" “);
Terminal.WriteLine(“Press 1 for the local library”);
Terminal.WriteLine(“Press 2 for the police station”);
Terminal.WriteLine(“Press 3 for NASA headquarters”);
Terminal.WriteLine(” “);
Terminal.WriteLine(“Enter your selection:”);
Terminal.WriteLine(” ");
}
void OnUserInput(string input)
{
Terminal.WriteLine(“The user typed " + “’” + input + “’”);
Terminal.WriteLine(” “);
if (input == “1”)
{
Terminal.WriteLine(“You chose level 1.”);
Terminal.WriteLine(” “);
StartGame(1);
}
else if (input == “menu”)
{
ShowMainMenu();
}
else if (input == “007”)
{
Terminal.WriteLine(“Hello, Mr. Bond; please choose a level.”);
Terminal.WriteLine(” “);
}
else if (input == “2”)
{
Terminal.WriteLine(“You chose level 2.”);
Terminal.WriteLine(” “);
}
else if (input == “3”)
{
Terminal.WriteLine(“You chose level 3.”);
Terminal.WriteLine(” “);
}
else
{
Terminal.WriteLine(“Please choose an valid input”);
Terminal.WriteLine(” ");
}
}
// Update is called once per frame
void Update()
{
}
}

This is where your error is at if you want tis to be a function you have to define it somewhere like this public Void StartGame(int someNumber){ // logic here}

hope this helps you

Lloyd Risper

Wow, thank you for the quick reply!

So, commenting out that line seems to get everything back in shape for now.
I’ll have to watch and follow the whole lecture before saving and playing the scene from now on.

1 Like

np glad i could help just remember to use a function that you make you have to define it then you can use it after you define it

Lloyd Risper

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms