# Set

> Set the value of a field in an object (non-static).

## Definition

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

## Set\<T>(string, T)

Set the value of a field in an object (non-static).

```csharp
public void Set<FieldType>(string fieldName, FieldType val)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The name of the field (e.g. *int counter;* would have fieldName = "counter").**** (T): The value to assign to the field. It has to match the field type.

### Remarks

The generic parameter determines the field type.

### Examples

```csharp
using UnityEngine;

public class Example : MonoBehaviour
{
    void Start()
    {
        AndroidJavaObject javaObject = new AndroidJavaObject("android.text.format.Time");
        javaObject.Set<bool>("allDay", true);
    }
}
```

## Set\<T>(IntPtr, T)

Set the value of a field in an object (non-static).

```csharp
public void Set<FieldType>(IntPtr fieldID, FieldType val)
```

### Parameters

**** (\[IntPtr]\(https\://learn.microsoft.com/dotnet/api/system.intptr)): The ID of the field to set.**** (T): The value to assign to the field. It has to match the field type.

### Remarks

The generic parameter determines the field type.
