LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

This version of Unity is unsupported.

AndroidJavaObject.Get

public FieldType Get(string fieldName);

Parameters

fieldNameThe name of the field (e.g. int counter; would have fieldName = "counter").

Description

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

The generic parameter determines the field type.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { void Start() { AndroidJavaObject jo = new AndroidJavaObject("android.os.Message"); int valueString = jo.Get<int>("what"); } }