[SOLVED] Console stays empty on play

Hi, I suffered a system lockup/crash requiring a hard restart towards the end of this lesson. On restart, my code is all still saved in MonoDevelop Scripts, but when i run it in Unity the Console screen stays blank. Oddly, if i insert a deliberate error into the code, the Unity Console declares the error. Save files look to be intact, console view options look correct.
Code is
using UnityEngine;
using System.Collections;

public class NumberWizard : MonoBehaviour {

// Use this for initialization
void Start () {
	print ("Welcome to Number Wizard");
	print ("Pick a number in your head but don't tell me!");
	
	int max = 1000;
	int min = 1;
	
	print ("The highest number you can pick is " + max);
	print ("The lowest number you can pick is " + min);
	
	print ("Is the number higher or lower than 500?");
	print ("Up = higher, Down = lower and Return = Equals");
	
}

// Update is called once per frame
void Update () {
	if (Input.GetKeyDown (KeyCode.UpArrow)) {
		print("Up arrow pressed");
	}else if (Input.GetKeyDown (KeyCode.DownArrow)) {
		print("Down arrow pressed");
	}else if (Input.GetKeyDown (KeyCode.Return)) {
		print("I WON, WHOOP!");
	}
}

}

is the script attached to the camera? or an active gameobject in the scene?
might not have saved that after your crash.

Thanks for your reply. I have not gotten as far as game objects or using the camera! Don’t worry, it will be good for me to junk it and start again from scratch anyway. Cheers!

1 Like

No worries Nick, you have the script there, seen as the pc/unity crashed, if you dont want to have to retype it all again, might be worth having another little watch over of lecture 16 in the Number Wizard (printing text to the console).

if your still getting issues down the line, just shout. :+1:

Hi Darren,
Thanks for your help. It is the weirdest thing!
I cleared all projects and scripts and started again, but even just adding
a simple print (“hello”); line did not appear on the console when played.
I can see it in the inspector, no problem - it is just not showing anything
in the console tab!
I’ve checked and unchecked all the view options I can see (Clear, Collapse,
Clear on Play, Error Pause) plus Layers is set to Everything and Layout is
Default.
I can’t help feeling there is something really simple that I am missing.
If all else fails I will uninstall/reinstall Unity, in case the install was
corrupted by the crash - but it’s bugging me now, I want to know why it’s
doing this!
Cheers,
Nick

Mornin Nick,

ok, so lets start with a couple of little checks see if we cant find out where the Gremlins are :slight_smile:

Im assuming that were using the script above as it looks fine, and that we have this script saved somewhere in the project and its called NumberWizard.cs.

in the heirarchy do you have the Number Wizard game object, like below (naming/spelling etc of this isnt important at this time)

with that object in the heirarchy selected, have a look at the inspector tab. is your script showing there? and enabled (so its got a tick in that box next to the name)

when you press play at that point does it show anything in the console window?

the console itself does have some other toggleable filters on the right hand side.

we have (from left to right)
information speech bubble - this will show all our print and debug messages
Warning Triangle - shows warnings about your project that are worth considering, but not show stopers
Error Sign - project errors that need to be addressed

the information speech bubble, need to make sure thats toggled inwards so that it will show information.

try it, press play and toggle this one , and it should show/hide the info for your print messages.

it should display 6 there, as thats the number of print statements you have ran, thats your code im using, to see if you get the same.

1 Like

Ah, got it - you were right!
The GameObject had changed back to Camera.
Reset as it should be and Console is working fine again.
I can feel my brain creaking…
Thanks for your help! :slight_smile:
Nick

No worries at all :slight_smile:
glad its working, if you could mark the first post as Solved that would be cool.