So I’m really new to unity and I’m following a very simple video:
but in my console, I have no output.
What I’ve tried:
verify that all 3 output icons are toggled active (top right of console)
attach script to the Main Camera
delete/redo project from scratch
make sure the script is correct
…
using UnityEngine;
using System;
public class NewBehaviourScript : MonoBehaviour {
void start ()
{
UnityEngine.Debug.Log("info");
Debug.Log("lol");
Debug.LogWarning("warn");
Debug.LogError("error");
Debug.LogException(new Exception("exception"));
}
}
The extra namespace usage was one suggestion on this forum (UnityEngine.Debug.Log(“info”);). I have looked at all the possible topics related to this issue, none of their solutions worked for me however.
Every one of the built-in callback methods on a MonoBehaviour (Awake, Start, Update, OnTriggerEnter, OnDestroy, etc. etc.) is case-sensitive. But, unlike things like type names or method names, you won’t get compilation errors if the method is spelled wrong - you’ll just end up with nothing happening.
This is because Unity does black magic behind the scenes to actually make those methods run - black magic that was probably a really bad idea to begin with (I’ve seen Unity devs write that they would fix that if it wouldn’t break every script in existance). So, be careful with how you spell those method names!
I think it simply uses reflection to find function which it tries to call, so no black magic there. If your function have different name than the one searched (eg different capitalization) it will not find it.
Its worth to mention that it would find only child function so for example:
class A : MonoBehaviour
{
void Awake()
{
Debug.Log("A");
}
}
class B : A
{
void Awake()
{
Debug.Log("B");
}
}
would print only B, because function woudl be found in the child class and no reference to parent. So dont expect all those functions to be called magically ;D