Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


CloneReference()

Creates a clone of the C# object that references the same Java object.
Read time 1 minuteLast updated 4 days ago

Definition

  • Type: Method
  • Namespace: UnityEngine
  • Assembly: UnityEngine.AndroidJNIModule
public AndroidJavaObject CloneReference()

Returns

Type

Description

AndroidJavaObjectA new C# object which references the same Java object as the original instance.

Remarks

Allows you to create multiple C# instances referencing the same Java object. The Java object will be excluded from garbage collection until all the C# references to it are disposed or garbage collected. If you call this method on an AndroidJavaClass instance, the returned clone's type will also be AndroidJavaClass.