Building Android plugin for Unity part 1

in #android6 years ago (edited)


Hello Steemit friends so I was building an android plugin for Unity so that my unity game can call the eos meet.one wallet on the android phone, first step is to create a new android project lets call it "plugin1"


Then immediately we need to create a new module called "plugin1lib" because this will become the library we want to build for our Unity


Then we need to create a new class for our library so that we can later call this class from our unity, then we just put in below simple code where if unity can successfully call us, then it will tell the log this is showing from android native

package com.example.plugin1lib;

import android.util.Log;
public class plugin1class
{

public void mylog()
{
Log.d("Unity","ahahahahahaha this is native new new new new new");
}
}


Once you click the Build->make module 'plugin1lib' , you should have generated a classes.jar file under the folder plugin1lib/build/intermediates/packaged-classes/debug/classes.jar

You need to copy this jar file to the Unity project/Assets/Plugins/Android/ folder so that Unity can find it

Then inside your unity you can call the android class via the "AndroidJavaObject"

AndroidJavaObject myaaa;

myaaa = new AndroidJavaObject("com.example.plugin1lib.plugin1class");

myaaa.Call("mylog");

Then when you build setting-> build and run on your android phone, you should check the logcat on the android studio and see the log "ahahahahahaha this is native new new new new new"

Thanks for reading

  <br /><center><hr/><em>Posted from my blog with <a href='https://wordpress.org/plugins/steempress/'>SteemPress</a> : http://fundurian.vornix.blog/2019/01/09/building-android-plugin-for-unity-part-1/ </em><hr/></center>

Sort:  

You’ve been upvoted by TeamMalaysia community. Do checkout other posts made by other TeamMalaysia authors at http://steemit.com/created/teammalaysia

To support the growth of TeamMalaysia Follow our upvotes by using steemauto.com and follow trail of @myach

Vote TeamMalaysia witness bitrocker2020 using this link vote for witness

大佬,這個可以加 #steemstem 說不定可以得到點贊😎

Posted using Partiko Android

好的,我试看

現在不要改。改了巨蝦可能不來點贊

Posted using Partiko Android

還有,中間製造 library 過後變成第三者 you should 了。不夠一貫性。如果繼續 We should 就好了。記得巨蝦點贊前不要改貼子。改了足版就一拼被改了😣

Posted using Partiko Android

吃了吗?这是哪里?你是谁?我为什么会来这边?你不要给我点赞不要点赞,哈哈哈哈哈哈。假如我的留言打扰到你,请回复“取消”。

Congratulations! This post has been upvoted from the communal account, @minnowsupport, by fundurian from the Minnow Support Project. It's a witness project run by aggroed, ausbitbank, teamsteem, someguy123, neoxian, followbtcnews, and netuoso. The goal is to help Steemit grow by supporting Minnows. Please find us at the Peace, Abundance, and Liberty Network (PALnet) Discord Channel. It's a completely public and open space to all members of the Steemit community who voluntarily choose to be there.

If you would like to delegate to the Minnow Support Project you can do so by clicking on the following links: 50SP, 100SP, 250SP, 500SP, 1000SP, 5000SP.
Be sure to leave at least 50SP undelegated on your account.

Hi @fundurian!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your UA account score is currently 3.972 which ranks you at #3776 across all Steem accounts.
Your rank has not changed in the last three days.

In our last Algorithmic Curation Round, consisting of 233 contributions, your post is ranked at #125.

Evaluation of your UA score:
  • You're on the right track, try to gather more followers.
  • The readers like your work!
  • You have already shown user engagement, try to improve it further.

Feel free to join our @steem-ua Discord server

Coin Marketplace

STEEM 0.19
TRX 0.15
JST 0.029
BTC 63252.26
ETH 2662.75
USDT 1.00
SBD 2.79