Legacy Documentation: Version 5.1
LanguageEnglish
  • C#
  • JS

Script language

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

AndroidJavaProxy.Invoke

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Switch to Manual
public function Invoke(methodName: string, args: object[]): AndroidJavaObject;
public AndroidJavaObject Invoke(string methodName, object[] args);
public function Invoke(methodName: string, javaArgs: AndroidJavaObject[]): AndroidJavaObject;
public AndroidJavaObject Invoke(string methodName, AndroidJavaObject[] javaArgs);

Parameters

methodName Name of the invoked java method.
args Arguments passed from the java vm - converted into AndroidJavaObject, AndroidJavaClass or a primitive.
javaArgs Arguments passed from the java vm - all objects are represented by AndroidJavaObject, int for instance is represented by a java.lang.Integer object.

Description

Called by the java vm whenever a method is invoked on the java proxy interface. You can override this to run special code on method invokation, or you can leave the implementation as is, and leave the default behavior which is to look for c# methods matching the signature of the java method.