GetFieldID
Scans a particular Java class for a field matching a name and a signature.
Read time 2 minutesLast updated 4 days ago
Definition
- Type: Method
- Namespace: UnityEngine
- Assembly: UnityEngine.AndroidJNIModule
GetFieldID(IntPtr, string)
Scans a particular Java class for a field matching a name and a signature.
public static nint GetFieldID(nint javaClass, string fieldName)
Parameters
Returns
Type | Description |
|---|---|
| IntPtr |
Remarks
The signature comparison is done to allow sub-/base-classes of a class types. If no signature is provided the first field with the correct name will be returned.
Additional Resources: AndroidJNIHelper.GetSignature, AndroidJNIHelper.GetConstructorID, AndroidJNIHelper.GetMethodID
GetFieldID(IntPtr, string, string)
Scans a particular Java class for a field matching a name and a signature.
public static nint GetFieldID(nint javaClass, string fieldName, string signature)
Parameters
Returns
Type | Description |
|---|---|
| IntPtr |
Remarks
The signature comparison is done to allow sub-/base-classes of a class types. If no signature is provided the first field with the correct name will be returned.
Additional Resources: AndroidJNIHelper.GetSignature, AndroidJNIHelper.GetConstructorID, AndroidJNIHelper.GetMethodID
GetFieldID(IntPtr, string, string, bool)
Scans a particular Java class for a field matching a name and a signature.
public static nint GetFieldID(nint javaClass, string fieldName, string signature, bool isStatic)
Parameters
Raw JNI Java class object (obtained by calling AndroidJNI.FindClass).
Name of the field as declared in Java.
Field signature (e.g. obtained by calling AndroidJNIHelper.GetSignature).
Set to \<tt\>true\</tt\> for static fields; \<tt\>false\</tt\> for instance (nonstatic) fields.
Returns
Type | Description |
|---|---|
| IntPtr |
Remarks
The signature comparison is done to allow sub-/base-classes of a class types. If no signature is provided the first field with the correct name will be returned.
Additional Resources: AndroidJNIHelper.GetSignature, AndroidJNIHelper.GetConstructorID, AndroidJNIHelper.GetMethodID
GetFieldID<T>(IntPtr, string, bool)
Get a JNI field ID based on type detection. Generic parameter represents the field type.
public static nint GetFieldID<FieldType>(nint jclass, string fieldName, bool isStatic)
Parameters
Returns
Type | Description |
|---|---|
| IntPtr |
Remarks
Scans a particular Java class for a field matching a signature of the field type. The signature comparison is done to allow for sub-/base-classes of the class types.