Version: 2019.2
public static void LogError (object message);
public static void LogError (object message, Object context);

パラメーター

message表示の際に文字列として変換対象となる文字列やオブジェクト
contextメッセージが適用されるオブジェクト

説明

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

When you select the message in the console a connection to the context object will be drawn. This is very useful if you want know on which object an error occurs.

メッセージが文字列であるとき、リッチテキストマークアップを使用して強調することができます。利用可能であるさまざまなマークアップタグについてはマニュアルの リッチテキスト を参照してください。

See Also: Debug.unityLogger, ILogger, Logger.LogError.

using UnityEngine;
using System.Collections;

public class MyGameClass : MonoBehaviour { private Transform transform;

void MyGameMethod() { if (transform == null) Debug.LogError("memberVariable must be set to point to a Transform.", transform); } }

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