Unity Console Error

Running my script I get the following messages:

The referenced script on this Behaviour is missing!
The referenced script on this Behaviour (Game Object 'consolePrinterGO') is missing!

Any ideas? My ConsolePrinter.cs looks like this:

using UnityEngine;
using System.Collections;

        public class ConsolePrinter : MonoBehaviour {

        	// Use this for initialization
        	void Start () {
        		float location= 5.0f;//distance in meters
        		float homeLocation = 2.1f;
        		float distance = homeLocation - location;
        		bool isTwoGreaterThanOne = true;
        		print("Welcome to Go Home!");
        		print("You must find your way back home");
        		print("Distance: " + distance);
        		print("Is 2 greater than 1: " + isTwoGreaterThanOne);

        	}
        	
        	// Update is called once per frame
        	void Update () {

        }
        }

My only Project assets are ConsolePrinter.cs and Main

Have you renamed your script file but not changed the name of the class?

Also… is consolePrinterGO a game object in your scene Main? If so, have you dragged the script onto it?

As Rob said, You need to make the gameobject in your scene called ConsolePrinterGO and attach your script to it.
I believe Sam added the gameobject prior to the video you are on.

Hope this helps

1 Like

Any luck with these suggestions?

1 Like

Do mark a solution if it worked.

Privacy & Terms