AndroidJavaObject.Set

Declaration

public void Set(string fieldName, FieldType val);

Parameters

Parameter Description
fieldName The name of the field (e.g. int counter; would have fieldName = "counter").
val The value to assign to the field. It has to match the field type.

Description

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

The generic parameter determines the field type.

using UnityEngine;

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

Declaration

public void Set(IntPtr fieldID, FieldType val);

Parameters

Parameter Description
fieldID The ID of the field to set.
val The value to assign to the field. It has to match the field type.

Description

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

The generic parameter determines the field type.


Did you find this page useful? Please give it a rating: