Struggling over here

Hi everyone, I am having a problem getting my code to show up. I keep getting a blank screen when it runs. Here’s my code and here’s the screen it generates. I can’t seem to find the error as it looks to me like it’s exactly the same code as from the lecture.

I also don’t know if this is the right place to ask for help or if there is another area on here.

Hi Allan,

It’s find to post here, you can of course also use the Q&A on Udemy for the specific lecture if it is a course related query.

If you look at the console you’ll see you have an error, this is why your text isn’t appearing, because you code has been stopped before it could execute.

The error relates to Terminal.cs, line 22, however, it’s possible that your code may be responsible. Could you copy/paste your entire script into a reply please and apply code formatting.


Updated Thu Jan 31 2019 20:48

Just out of interest, have you added you Hacker.cs script as a component to the WM2000 GameObject in the Hierarchy?


Please note, it’s better to copy/paste your code and apply the code fencing characters, rather than using screenshots. Screenshots are ideal for displaying specific details from within a game engine editor or even error messages, but for code, they tend to be less readable, especially on mobile devices which can require extensive zooming and scrolling.

You also prevent those that may offer to help you the ability to copy/paste part of your code back to you with suggestions and/or corrections, meaning that they would need to type a potentially lengthy response. You will often find that people are more likely to respond to your questions if you make it as easy as possible for them to do so.

Hope this helps :slight_smile:


See also;

Sure thing!

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

public class Hacker : MonoBehaviour
{
    // Start is called before the first frame update
    void Start () {
        ShowMainMenu("Hello Allan");
    }

    void ShowMainMenu (string greeting) {
        Terminal.ClearScreen();
        Terminal.Writeline(greeting);
        Terminal.WriteLine("What would you like to hack into?");
        Terminal.WriteLine("1. Your mom's phone");
        Terminal.WriteLine("2. Your permanent records");
        Terminal.WriteLine("Enter Your Selection: ");
    }
    
    // Update is called once per frame
    void Update() {
        
    }
}

Hi Allan,

There’s a typo on the second statement within ShowMainMenu, the WriteLine method has been spelt with a lowercase L.

Hope this helps :slight_smile:

See updated title of this thread :slight_smile:

1 Like

Glad this resolved the issue for you Allan. :slight_smile:


See also;

1 Like

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

Privacy & Terms