Use Debug.Break() to pause the editor - mostly asked by developers
Neel Gajjar - Unity Developer
By: Neel Gajjar - Unity Developer

Use Debug.Break() to pause the editor

Use Debug.Break() in your code to pause the editor

Did you know that you can control the unity editor play state directly from your code?

Suppose, there is a moment where you want to pause the execution to check your object values. In this situation use Debug.Break().




Sample code :

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DebugPauseScript : MonoBehaviour {

    public bool problem = false;

    void Update()

    {

        if (problem) {

            Debug.Break ();

        }

    }

}


Leave us a comment