Version: 5.3 (switch to 5.4b)
言語English
  • C#
  • JS

スクリプト言語

好きな言語を選択してください。選択した言語でスクリプトコードが表示されます。

Debug.LogException

マニュアルに切り替える
public static void LogException(Exception exception);
public static void LogException(Exception exception, Object context);

パラメーター

context メッセージが適用されるオブジェクト
exception Runtime Exception。

説明

Debug.Log の派生でエラーメッセージをコンソールに出力します。

コンソール上でメッセージを選択すると、コンテキストオブジェクトに対するラインが描画されます。 これはどのオブジェクトに対するエラーかを知るときに非常に役に立ちます。

See Also: Debug.logger, ILogger, Logger.LogException.

using UnityEngine;
using System.Collections;

public class MyGameClass : MonoBehaviour {

void MyGameMethod() { try { // Do something that can throw an exception } catch (Exception e) { Debug.LogException(e, this); } } }

'ErrorPause' が有効な場合、エディターが一時停止することに注意してください。