Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Example app of communication between Unity and Android. (Android Studio and Unity Project)

Notifications You must be signed in to change notification settings

inbgche/Unity-Android-Communication

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
5 Commits
 
 
 
 
 
 

Repository files navigation

Unity-Android-Communication

Example app of communication between Unity and Android. (Android Studio and Unity Project)

  • These are a sample Unity and a Android Studio project that communicate each other.
  • The unity app can call android native API

In C# (Caller)

    AndroidManager.GetInstance().CallJavaFunc( "javaTestFunc", "UnityJavaJarTest" );

In Android (Callee)

    public void javaTestFunc(String strFromUnity) { 
        /* ... Do something here with java native api ... */ 
    } 
  • And the android can call Unity too.

In Android (Caller)

    UnityPlayer.UnitySendMessage("AndroidManager", "SetJavaLog", strFromUnity + "HelloWorld"); 

In C# (Callee)

    void SetJavaLog(string strJavaLog)
  	{
  		strLog = strJavaLog;
  		_text.text = strLog;
  	}

Use your own keystore to play the app on a phone.

About

Example app of communication between Unity and Android. (Android Studio and Unity Project)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
Morty Proxy This is a proxified and sanitized view of the page, visit original site.