Debug.LogWarning 记录警告


static function LogWarning (message : object) : void

Description描述

A variant of Debug.Log that logs a warning message to the console.

Debug.Log的一个变体,是用来记录一个警告消息到控制台。

  • C#

  • JavaScript

using UnityEngine;using System.Collections;public class example : MonoBehaviour {public void Awake() {Debug.LogWarning("Watch out!, this is a warning!");}}
Debug.LogWarning("Watch out!, this is a warning!");

• static function LogWarning (message : object, context : Object) : void

Description描述

A variant of Debug.Log that logs a warning message to the console.

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 a warning occurs.

当你在看控制台选择消息的时候,到上下文物体的一个连接将被绘制。如果你想知道在那个对象上发生了警告,这是非常有用的。

  • C#

  • JavaScript

using UnityEngine;using System.Collections;public class example : MonoBehaviour {public void Awake() {Debug.LogWarning("A warning assigned to this transform!", transform);}}
Debug.LogWarning("A warning assigned to this transform!", transform);


,