Debug.Log not working

using UnityEngine;
using System.Collections;

public class NewBehaviourScript : MonoBehaviour
{
    Debug.Log ("test");
}

Debug.Log just stopped working. It wouldn’t auto complete in MonoDevelop and gave me an error.

So, I opened a new project and a new script just to test Debug.Log

The code at the top is the exact c# script I’m trying to get to work with now. It gives me the error “Invalid token ‘(’ in class, struct, or interface member declaration (CS1519…”

Is Unity or Monodevelop broken? Should I just reinstall them?

Oh and UnityEngine.Debug.Log doesn’t work either…

o__o
You need to put that in a function…
Everything but declerations & imports need to be written inside functions.
Start() { } Get’s called right away when you start ur scene. So put the debug.log inside that if u want it to be called once.

using UnityEngine;
using System.Collections;

public class NewBehaviourScript : MonoBehaviour
{
    void Start () {
        Debug.Log ("test");
    }
}

Watch this, it should help you alot :3
By the way, maybe it’s a good idea to learn the basics of programming xD

1 Like

Thank you… I have to stop working this late I do the stupidest things and get so frustrated…