# GetConstructorID

> Scans a particular Java class for a constructor method matching a signature.

## Definition

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

## GetConstructorID(IntPtr)

Scans a particular Java class for a constructor method matching a signature.

```csharp
public static IntPtr GetConstructorID(IntPtr javaClass)
```

### Parameters

**** (\[IntPtr]\(https\://learn.microsoft.com/dotnet/api/system.intptr)): Raw JNI Java class object (obtained by calling AndroidJNI.FindClass).

### Returns

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

### Remarks

The signature comparison is done to allow for sub-/base-classes of the class types. If no signature is provided the first constuctor found will be returned.

Additional Resources: [AndroidJNIHelper.GetSignature](/engine/6000.0/script-reference/unityengine/androidjnihelper/getsignature.md), [AndroidJNIHelper.GetMethodID](/engine/6000.0/script-reference/unityengine/androidjnihelper/getmethodid.md), [AndroidJNIHelper.GetFieldID](/engine/6000.0/script-reference/unityengine/androidjnihelper/getfieldid.md).

## GetConstructorID(IntPtr, string)

Scans a particular Java class for a constructor method matching a signature.

```csharp
public static IntPtr GetConstructorID(IntPtr javaClass, string signature)
```

### Parameters

**** (\[IntPtr]\(https\://learn.microsoft.com/dotnet/api/system.intptr)): Raw JNI Java class object (obtained by calling AndroidJNI.FindClass).**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Constructor method signature (e.g. obtained by calling AndroidJNIHelper.GetSignature).

### Returns

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

### Remarks

The signature comparison is done to allow for sub-/base-classes of the class types. If no signature is provided the first constuctor found will be returned.

Additional Resources: [AndroidJNIHelper.GetSignature](/engine/6000.0/script-reference/unityengine/androidjnihelper/getsignature.md), [AndroidJNIHelper.GetMethodID](/engine/6000.0/script-reference/unityengine/androidjnihelper/getmethodid.md), [AndroidJNIHelper.GetFieldID](/engine/6000.0/script-reference/unityengine/androidjnihelper/getfieldid.md).

## GetConstructorID(IntPtr, Object\[])

Get a JNI method ID for a constructor based on calling arguments.

```csharp
public static IntPtr GetConstructorID(IntPtr jclass, object[] args)
```

### Parameters

**** (\[IntPtr]\(https\://learn.microsoft.com/dotnet/api/system.intptr)): **** (\[Object\[]]\(https\://learn.microsoft.com/dotnet/api/system.object)): Array with parameters to be passed to the constructor when invoked.

### Returns

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

### Remarks

Scans a particular Java class for a constructor method matching a signature based on passed arguments. The signature comparison is done to allow for sub-/base-classes of the class types.
