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.
Read time 1 minuteLast updated 7 days ago
Definition
- Type: Method
- Namespace: UnityEngine
- 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.
public static nint NewObject(nint clazz, nint methodID, jvalue[] args)
Parameters
Returns
Type | Description |
|---|---|
| IntPtr | A local reference to the newly constructed object. |
Remarks
Additional Resources: Java Native Interface Specification (Oracle)
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 with as the method name and as the return type.
GetMethodIDinitvoid (V)public static nint NewObject(nint clazz, nint methodID, Span<jvalue> args)
Parameters
The Java class to instantiate.
The ID of the constructor to invoke.
An array of arguments to pass to the constructor.
Returns
Type | Description |
|---|---|
| IntPtr | A local reference to the newly constructed object. |
Remarks
Additional Resources: Java Native Interface Specification (Oracle)