top of page

Data Transfer Between Our Unity Library and Native Android: A Step-by-Step Guide

Updated: Mar 4

This document explains how to communicate between Unity and Android Native.


Requirement:


COMMUNICATIONS:


  1. Android (Java) -> Unity (C#): In Android, start the UnityPlayerActivity from your Activity with an Intent and add data to this intent using putExtra: Intent intent = new Intent(this, UnityPlayerActivity.class); intent.putExtra("gameName", "{value}"); startActivity(intent);

  2. Unity (C#) -> Android (Java): In Android, create a method in UnityPlayerActivity to receive data from Unity. This method can be directly called from Unity: public void onGameFinish(int score) { //will be called on game over } public void onGameQuit() {     //will be called on user button press }

27 views0 comments

Recent Posts

See All
bottom of page