# DetachCurrentThread()

> Detaches the current thread from a Java (Dalvik) VM.

## Definition

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

```csharp
public static int DetachCurrentThread()
```

### Returns

| Type                                                       | Description                                    |
| ---------------------------------------------------------- | ---------------------------------------------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | Zero on success. A negative number on failure. |

### Remarks

A thread must be detached from the VM before exiting.

Additional Resources: [Java Native Interface Specification (Oracle)](http://download.oracle.com/javase/1.5.0/docs/guide/jni/spec/jniTOC.html)
