Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Beginning Game Designer: Need Help

Discussion in 'Editor & General Support' started by GoBroHo, Oct 16, 2014.

  1. GoBroHo

    GoBroHo

    Joined:
    Jul 4, 2014
    Posts:
    3
    I picked up a book on game design for complete beginners called "Introduction to Game Design, Prototyping and Development". Everything was fine until I got to the "Hello World: Your First Program" chapter. I followed all the instructions until it said that I had to drag my c# script onto the main camera. I tried to do this but everytime a message popped up saying "NullReferrenceException: Object refererence not set to an instance of the object" Here's the script if that helps: using UnityEngine;
    using System.Collections;

    public class HelloWorld:MonoBehaviour {

    // Use this for initialization
    void Start () {
    print ("HelloWorld");
    }

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

    }
    }
     
  2. RJ-MacReady

    RJ-MacReady

    Joined:
    Jun 14, 2013
    Posts:
    1,718
    I don't see you referencing any objects in this script. This script works perfectly, as well. What other scripts are in your scene? Because the problem isn't here.
     
  3. GoBroHo

    GoBroHo

    Joined:
    Jul 4, 2014
    Posts:
    3
    This is the only script in my scene
     
  4. SaraCecilia

    SaraCecilia

    Joined:
    Jul 9, 2014
    Posts:
    675
    Do you have any other objects in the scene with attached scripts?
     
  5. GoBroHo

    GoBroHo

    Joined:
    Jul 4, 2014
    Posts:
    3
    No
     
  6. RJ-MacReady

    RJ-MacReady

    Joined:
    Jun 14, 2013
    Posts:
    1,718
    Thanks for all the information.