Terminal input/output not working

hey guys i ran into a problem if anyone would help me?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Hacker : MonoBehaviour {

     
	// Use this for initialization
	void Start () {
        ShowMenuscreen("hello nihal");
        
    }
	
    void ShowMenuscreen (string Greeting)
    {
        Terminal.ClearScreen();
        Terminal.WriteLine(Greeting);
        Terminal.WriteLine("");
        Terminal.WriteLine("WHERE WOULD U LIKE TO HACK TODAY");
        Terminal.WriteLine("");
        Terminal.WriteLine("Press 1 to hack into a restarunt");
        Terminal.WriteLine("Press 1 to hack into an ATM");
        Terminal.WriteLine("");
        Terminal.WriteLine("ENTER YOUR SELECTION HERE -");
    }

    void onUserinput (string input)
    {
        if (input == "1")
        {
            Terminal.WriteLine("You choose level 1");
        } else if (input == "2")
        {
            Terminal.WriteLine("You choose level 2");
        }else 
        {
            Terminal.WriteLine("Error chose a valid operation");
        }
    }

    }

i dont get the output correctly just like shown here

PNG

Hi,

What output did you expect? Have you already compared your code to the Lecture Project Changes which can be found in the Resources of this lecture?

There is a typo in your method name. The name should be OnUserInput not onUserInput. C# is case-sensitive.

yes i just figured that out 1 minute before your reply… works now
thanks by the way…

Fantastic. :slight_smile:


See also:

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

Privacy & Terms