# LogAssertion

> A variant of Debug.Log that logs an assertion message to the console.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine](/engine/6000.0/script-reference/unityengine.md)
* **Assembly:** UnityEngine.CoreModule

## LogAssertion(Object)

A variant of Debug.Log that logs an assertion message to the console.

```csharp
[Conditional("UNITY_ASSERTIONS")]
public static void LogAssertion(object message)
```

### Parameters

**** (\[Object]\(https\://learn.microsoft.com/dotnet/api/system.object)): String or object to be converted to string representation for display.

### Remarks

Message of a type of [LogType.Assert](/engine/6000.0/script-reference/unityengine/logtype/assert.md) is logged.

Note that these methods work only if UNITY\_ASSERTIONS symbol is defined. This means that if you are building assemblies externally, you need to define this symbol otherwise the call becomes a no-op. (For more details see [System.Diagnostics.ConditionalAttribute](https://msdn.microsoft.com/en-us/library/system.diagnostics.conditionalattribute\(v=vs.110\).aspx) on the MSDN website.

## LogAssertion(Object, Object)

A variant of Debug.Log that logs an assertion message to the console.

```csharp
[Conditional("UNITY_ASSERTIONS")]
public static void LogAssertion(object message, Object context)
```

### Parameters

**** (\[Object]\(https\://learn.microsoft.com/dotnet/api/system.object)): String or object to be converted to string representation for display.**** (\[Object]\(/engine/6000.0/script-reference/unityengine/object)): Object to which the message applies.

### Remarks

Message of a type of [LogType.Assert](/engine/6000.0/script-reference/unityengine/logtype/assert.md) is logged.

Note that these methods work only if UNITY\_ASSERTIONS symbol is defined. This means that if you are building assemblies externally, you need to define this symbol otherwise the call becomes a no-op. (For more details see [System.Diagnostics.ConditionalAttribute](https://msdn.microsoft.com/en-us/library/system.diagnostics.conditionalattribute\(v=vs.110\).aspx) on the MSDN website.
