OnInspectorGUI - GUILayout.Label doesn't exist?

The compiler is telling me that “The name ‘GUILayout’ does not exist in the current context.” I don’t see how that can be true, especially since I’m following a video tutorial of it. Did something change, or what I am I doing wrong?

using UnityEditor;

[CustomEditor (typeof (playerSpawnScript))]
public class PlayerSpawnEditor : Editor
private SerializedObject m_Object;
private SerializedProperty m_Speed;

public void OnEnable ()
	m_Object = new SerializedObject (target);
	m_Speed = m_Object.FindProperty("speed");

public override void OnInspectorGUI ()
	GUILayout.Label("Player Spawn", EditorStyles.boldLabel);


I’ve looked up the API references and according to what it says I have everything correct, yet this error! Help!

Ever heared of namespaces? :wink:

Use just use the UnityEditor namespace which just contains the Unity editor specific addons.

All you need to do is also include the UnityEngine namespace:

using UnityEditor;
using UnityEngine;