import UnityEngine
class GameOver (MonoBehaviour):
public daFont as Font
def OnGUI():
textStyle as GUIStyle
textStyle.font = daFont
GUI.Label(Rect(Screen.width / 2, Screen.height / 2, 500, 500), "Game Over.", textStyle)
Where is the null reference? It says this line is:
textStyle.font = daFont
I set daFont in the editor, so it shouldn’t be null?
Doh! I fixed it…
import UnityEngine
class GameOver (MonoBehaviour):
public daFont as Font
def OnGUI():
textStyle = GUIStyle(GUI.skin.label) // Fixed...
textStyle.font = daFont
GUI.Label(Rect(Screen.width / 2, Screen.height / 2, 500, 500), "Game Over.", textStyle)