I’m just trying to figure out how to run scripts in Unity and how it’s all organized. I am trying to run this script.
using UnityEngine;
using System.Collections;
public class SetupGameboard : MonoBehaviour {
private int myInt = 5;
void Start ()
{
myInt = MultiplyByTwo(myInt);
Debug.Log (myInt);
Debug.LogError ("error");
Debug.LogWarning ("warning");
}
int MultiplyByTwo (int number)
{
int ret;
ret = number * 2;
return ret;
}
public void Update () {
Debug.Log("Test");
}
}
When I press play, nothing appears in the console. I’ve tried turning the info/warn/error flags on/off in the right side of the console, tried collapsing it (based on another answer). I’ve made sure my script is attached to an object in my game(I think it’s in my game, it appears when I press play). I tried to use the debugger, and it hit the breakpoint in the start method, but when I stepped over nothing happened. I wasn’t able to hit a breakpoint in the update method because it was greyed out for some reason.
I’m probably missing something very simple, so any help would be very appreciated.
I'm struggling to see a problem here. Assuming the script is attached to a gameObject in the scene and everything is enabled there should be no problem.
– KiwasiTry: 1.) Restarting Unity 2.) Restarting your computer 3.) Copy your scene into a new project 4.) Reinstall Unity You shouldn't need to get to 4 though. This happened to me in the past, but I don't know how I fixed it. As long as it's on an actual GameObject and it's enabled (both the GameObject and the script component), it should work. Try
– Firedan1176Application.Quit()where your debugs are and see if it instantly quits the window.