# NewObject

> Constructs a new Java object. The method ID indicates which constructor method to invoke. This ID must be obtained by calling GetMethodID() with \<init\> as the method name and void (V) as the return type.

## Definition

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

## NewObject(IntPtr, IntPtr, jvalue\[])

Constructs a new Java object. The method ID indicates which constructor method to invoke. This ID must be obtained by calling GetMethodID() with \\\<init\\> as the method name and void (V) as the return type.

```csharp
public static nint NewObject(nint clazz, nint methodID, jvalue[] args)
```

### Parameters

**** (\[IntPtr]\(https\://learn.microsoft.com/dotnet/api/system.intptr)): **** (\[IntPtr]\(https\://learn.microsoft.com/dotnet/api/system.intptr)): **** (jvalue\[]):&#x20;

### Returns

| Type                                                           | Description |
| -------------------------------------------------------------- | ----------- |
| [IntPtr](https://learn.microsoft.com/dotnet/api/system.intptr) |             |

### Remarks

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

## NewObject(IntPtr, IntPtr, Span\<jvalue>)

Constructs a new Java object. The method ID indicates which constructor method to invoke. This ID must be obtained by calling GetMethodID() with \\\<init\\> as the method name and void (V) as the return type.

```csharp
public static nint NewObject(nint clazz, nint methodID, Span<jvalue> args)
```

### Parameters

**** (\[IntPtr]\(https\://learn.microsoft.com/dotnet/api/system.intptr)): **** (\[IntPtr]\(https\://learn.microsoft.com/dotnet/api/system.intptr)): **** (\[Span\<jvalue>]\(https\://learn.microsoft.com/dotnet/api/system.span-1)):&#x20;

### Returns

| Type                                                           | Description |
| -------------------------------------------------------------- | ----------- |
| [IntPtr](https://learn.microsoft.com/dotnet/api/system.intptr) |             |

### Remarks

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