SlideShare a Scribd company logo
1 of 10
Download to read offline
Plugin
What is Plugin?
• Libraries of native code written in C, C++,
Objective-C,….etc
• Allow your game code to call functions from
these libraries
Why do you need to
develop a Plugin?
• Unity3D can’t Do That
• Reuse C/C++/Objective-C components
• Difficult customize in Unity3D Assets Store
• Cross-Device
• Cross-Platform
• Security Issues

Plugins for Different Device
• iOS
#if UNITY_IOS
#else

#endif
if (Application.platform == RuntimePlatform.IPhonePlayer)
• Android
#if UNITY_ANDROID
#else

#endif
if (Application.platform == RuntimePlatform.Android)
iOS Plugins
• C/C++ Native Functions in xxx.mm
extern “C”{
float ReturnFloat()
{ return 10.5; }
}
• C# Dll Import

using System.Runtime.InteropServices;
[DllImport("__Internal")]
public static extern float ReturnFloat();
iOS Plugins
• C/C++ Native Functions in xxx.h
void UnitySendMessage(const char* obj, const char* method, const
char* msg);
• C/C++ Native Functions in xxx.mm
extern “C”{
void UnityMessage(char* obj, char* function, char* message){
UnitySendMessage(obj, function, message);}
}
• C# Dll Import

using System.Runtime.InteropServices;
[DllImport("__Internal")]
public static extern float UnityMessage(string obj, string function, string
message);
Android Plugins
• C/C++ Native Functions in xxx.mm
extern “C”{
float ReturnFloat()
{ return 10.5; }
}
• C# Dll Import

using System.Runtime.InteropServices;
[DllImport("__Internal")]
public static extern float ReturnFloat();
Android Plugins
• Jave Class
public class PlugInBridge{
public static float ReturnFloat()
{ return 10.5f; }
}
• C#

AndroidJNI.AttachCurrentThread();
AndroidJavaClass androidClass = new AndroidJavaClass
("com.example.unityplugin.PlugInBridge");
Debug.Log(androidClass.CallStatic< float >(“ReturnFloat"));
Android Plugins
• Overwrite onActivityResult
public class FTUnityPlayerActivity extends UnityPlayerActivity
{
public void onActivityResult(int requestCode, int resultCode,
Intent data)
{
Log.d("FTUnityPlayerActivity", "onActivityResult:
requestCode: " + requestCode + ", resultCode:" + resultCode);
}
}
Android Plugins
• Modify your Manifest.xml Automatically
<activity
android:name="com.example.unityplugin.FTUnityPlayerActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>


More Related Content

What's hot

Flutter tutorial for Beginner Step by Step
Flutter tutorial for Beginner Step by StepFlutter tutorial for Beginner Step by Step
Flutter tutorial for Beginner Step by StepChandramouli Biyyala
 
Using the Android Native Development Kit (NDK)
Using the Android Native Development Kit (NDK)Using the Android Native Development Kit (NDK)
Using the Android Native Development Kit (NDK)DroidConTLV
 
Using the Android Native Development Kit (NDK)
Using the Android Native Development Kit (NDK)Using the Android Native Development Kit (NDK)
Using the Android Native Development Kit (NDK)Xavier Hallade
 
#Code2Create:: Introduction to App Development in Flutter with Dart
#Code2Create:: Introduction to App Development in Flutter with Dart#Code2Create:: Introduction to App Development in Flutter with Dart
#Code2Create:: Introduction to App Development in Flutter with DartGDGKuwaitGoogleDevel
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and DevelopmentOpersys inc.
 
Introduction to the Android NDK
Introduction to the Android NDKIntroduction to the Android NDK
Introduction to the Android NDKBeMyApp
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and DevelopmentOpersys inc.
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and DevelopmentOpersys inc.
 
Embedded Android Workshop with Marshmallow
Embedded Android Workshop with MarshmallowEmbedded Android Workshop with Marshmallow
Embedded Android Workshop with MarshmallowOpersys inc.
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and DevelopmentOpersys inc.
 
Android NDK and the x86 Platform
Android NDK and the x86 PlatformAndroid NDK and the x86 Platform
Android NDK and the x86 PlatformSebastian Mauer
 
Embedded Android Workshop
Embedded Android WorkshopEmbedded Android Workshop
Embedded Android WorkshopOpersys inc.
 
Android things introduction - Development for IoT
Android things introduction - Development for IoTAndroid things introduction - Development for IoT
Android things introduction - Development for IoTBartosz Kosarzycki
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and DevelopmentKarim Yaghmour
 
Alberto Mancini - A few benchmark on Android
Alberto Mancini - A few benchmark on AndroidAlberto Mancini - A few benchmark on Android
Alberto Mancini - A few benchmark on Androidgdg-ancona
 
Developing Android Platform Tools
Developing Android Platform ToolsDeveloping Android Platform Tools
Developing Android Platform ToolsOpersys inc.
 

What's hot (20)

Flutter tutorial for Beginner Step by Step
Flutter tutorial for Beginner Step by StepFlutter tutorial for Beginner Step by Step
Flutter tutorial for Beginner Step by Step
 
NDK Introduction
NDK IntroductionNDK Introduction
NDK Introduction
 
Android ndk
Android ndkAndroid ndk
Android ndk
 
Using the Android Native Development Kit (NDK)
Using the Android Native Development Kit (NDK)Using the Android Native Development Kit (NDK)
Using the Android Native Development Kit (NDK)
 
Using the Android Native Development Kit (NDK)
Using the Android Native Development Kit (NDK)Using the Android Native Development Kit (NDK)
Using the Android Native Development Kit (NDK)
 
#Code2Create:: Introduction to App Development in Flutter with Dart
#Code2Create:: Introduction to App Development in Flutter with Dart#Code2Create:: Introduction to App Development in Flutter with Dart
#Code2Create:: Introduction to App Development in Flutter with Dart
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
 
Introduction to the Android NDK
Introduction to the Android NDKIntroduction to the Android NDK
Introduction to the Android NDK
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
 
Embedded Android Workshop with Marshmallow
Embedded Android Workshop with MarshmallowEmbedded Android Workshop with Marshmallow
Embedded Android Workshop with Marshmallow
 
Android ndk: Entering the native world
Android ndk: Entering the native worldAndroid ndk: Entering the native world
Android ndk: Entering the native world
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
 
Android NDK and the x86 Platform
Android NDK and the x86 PlatformAndroid NDK and the x86 Platform
Android NDK and the x86 Platform
 
Embedded Android Workshop
Embedded Android WorkshopEmbedded Android Workshop
Embedded Android Workshop
 
Android things introduction - Development for IoT
Android things introduction - Development for IoTAndroid things introduction - Development for IoT
Android things introduction - Development for IoT
 
Android NDK
Android NDKAndroid NDK
Android NDK
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
 
Alberto Mancini - A few benchmark on Android
Alberto Mancini - A few benchmark on AndroidAlberto Mancini - A few benchmark on Android
Alberto Mancini - A few benchmark on Android
 
Developing Android Platform Tools
Developing Android Platform ToolsDeveloping Android Platform Tools
Developing Android Platform Tools
 

Viewers also liked

Photon For Unity
Photon For Unity Photon For Unity
Photon For Unity Dat Pham
 
Unity5.3をさわってみた
Unity5.3をさわってみたUnity5.3をさわってみた
Unity5.3をさわってみたKeizo Nagamine
 
Unity In App Purchase (IAP)の使い方
Unity In App Purchase (IAP)の使い方Unity In App Purchase (IAP)の使い方
Unity In App Purchase (IAP)の使い方Makoto Ito
 
Unity5.3の機能まとめ
Unity5.3の機能まとめUnity5.3の機能まとめ
Unity5.3の機能まとめKeigo Ando
 
C mo-ganarse-la-vida-escribiendo-orientaciones-para-desarrollar-la-escritura-...
C mo-ganarse-la-vida-escribiendo-orientaciones-para-desarrollar-la-escritura-...C mo-ganarse-la-vida-escribiendo-orientaciones-para-desarrollar-la-escritura-...
C mo-ganarse-la-vida-escribiendo-orientaciones-para-desarrollar-la-escritura-...Jluis Dela Rosa
 
Roma solo fotos
Roma solo fotosRoma solo fotos
Roma solo fotoscarloslhoz
 
Semantický web a Drupal
Semantický web a Drupal Semantický web a Drupal
Semantický web a Drupal devmates
 
Chrome-eject がこの先生きのこるには
Chrome-eject がこの先生きのこるにはChrome-eject がこの先生きのこるには
Chrome-eject がこの先生きのこるにはYosuke HASEGAWA
 
SSBs Erling Holmøy_Norge eldes: Langsiktig økonomisk bærekraft 28.01.14
SSBs Erling Holmøy_Norge eldes: Langsiktig økonomisk bærekraft 28.01.14SSBs Erling Holmøy_Norge eldes: Langsiktig økonomisk bærekraft 28.01.14
SSBs Erling Holmøy_Norge eldes: Langsiktig økonomisk bærekraft 28.01.14Statistisk sentralbyrå
 
Roxana Ivan - Buget mic pentru evenimente mari (Impact Hub Bucharest, 2014.02...
Roxana Ivan - Buget mic pentru evenimente mari (Impact Hub Bucharest, 2014.02...Roxana Ivan - Buget mic pentru evenimente mari (Impact Hub Bucharest, 2014.02...
Roxana Ivan - Buget mic pentru evenimente mari (Impact Hub Bucharest, 2014.02...Lumea SEO PPC
 
Doing Terrifying Things - Nati Cohen, Similarweb - DevOpsDays Tel Aviv 2016
Doing Terrifying Things - Nati Cohen, Similarweb - DevOpsDays Tel Aviv 2016Doing Terrifying Things - Nati Cohen, Similarweb - DevOpsDays Tel Aviv 2016
Doing Terrifying Things - Nati Cohen, Similarweb - DevOpsDays Tel Aviv 2016DevOpsDays Tel Aviv
 
Madagascar analysis
Madagascar analysisMadagascar analysis
Madagascar analysiscroberts100
 
חשבון נפש: מצב לימודי המתמטיקה בישראל - 2014
חשבון נפש: מצב לימודי המתמטיקה בישראל - 2014חשבון נפש: מצב לימודי המתמטיקה בישראל - 2014
חשבון נפש: מצב לימודי המתמטיקה בישראל - 2014Eli Hurvitz
 
Tudatos márkaépítés
Tudatos márkaépítésTudatos márkaépítés
Tudatos márkaépítésGabor Papp
 

Viewers also liked (20)

Photon For Unity
Photon For Unity Photon For Unity
Photon For Unity
 
Unity5.3をさわってみた
Unity5.3をさわってみたUnity5.3をさわってみた
Unity5.3をさわってみた
 
Unity In App Purchase (IAP)の使い方
Unity In App Purchase (IAP)の使い方Unity In App Purchase (IAP)の使い方
Unity In App Purchase (IAP)の使い方
 
Unity5.3の機能まとめ
Unity5.3の機能まとめUnity5.3の機能まとめ
Unity5.3の機能まとめ
 
C mo-ganarse-la-vida-escribiendo-orientaciones-para-desarrollar-la-escritura-...
C mo-ganarse-la-vida-escribiendo-orientaciones-para-desarrollar-la-escritura-...C mo-ganarse-la-vida-escribiendo-orientaciones-para-desarrollar-la-escritura-...
C mo-ganarse-la-vida-escribiendo-orientaciones-para-desarrollar-la-escritura-...
 
Roma solo fotos
Roma solo fotosRoma solo fotos
Roma solo fotos
 
Boletín IV enero 2016
Boletín IV enero 2016Boletín IV enero 2016
Boletín IV enero 2016
 
Semantický web a Drupal
Semantický web a Drupal Semantický web a Drupal
Semantický web a Drupal
 
Chrome-eject がこの先生きのこるには
Chrome-eject がこの先生きのこるにはChrome-eject がこの先生きのこるには
Chrome-eject がこの先生きのこるには
 
SSBs Erling Holmøy_Norge eldes: Langsiktig økonomisk bærekraft 28.01.14
SSBs Erling Holmøy_Norge eldes: Langsiktig økonomisk bærekraft 28.01.14SSBs Erling Holmøy_Norge eldes: Langsiktig økonomisk bærekraft 28.01.14
SSBs Erling Holmøy_Norge eldes: Langsiktig økonomisk bærekraft 28.01.14
 
Roxana Ivan - Buget mic pentru evenimente mari (Impact Hub Bucharest, 2014.02...
Roxana Ivan - Buget mic pentru evenimente mari (Impact Hub Bucharest, 2014.02...Roxana Ivan - Buget mic pentru evenimente mari (Impact Hub Bucharest, 2014.02...
Roxana Ivan - Buget mic pentru evenimente mari (Impact Hub Bucharest, 2014.02...
 
Tesla Croatia
Tesla CroatiaTesla Croatia
Tesla Croatia
 
Doing Terrifying Things - Nati Cohen, Similarweb - DevOpsDays Tel Aviv 2016
Doing Terrifying Things - Nati Cohen, Similarweb - DevOpsDays Tel Aviv 2016Doing Terrifying Things - Nati Cohen, Similarweb - DevOpsDays Tel Aviv 2016
Doing Terrifying Things - Nati Cohen, Similarweb - DevOpsDays Tel Aviv 2016
 
Shepherd Elementary School Community Meeting Flyer
Shepherd Elementary School Community Meeting FlyerShepherd Elementary School Community Meeting Flyer
Shepherd Elementary School Community Meeting Flyer
 
Madagascar analysis
Madagascar analysisMadagascar analysis
Madagascar analysis
 
Philomena Detailed CV
Philomena Detailed CVPhilomena Detailed CV
Philomena Detailed CV
 
Marcelo acosta ac
Marcelo acosta acMarcelo acosta ac
Marcelo acosta ac
 
Hopes, plans and pleasures of children
Hopes, plans and pleasures of childrenHopes, plans and pleasures of children
Hopes, plans and pleasures of children
 
חשבון נפש: מצב לימודי המתמטיקה בישראל - 2014
חשבון נפש: מצב לימודי המתמטיקה בישראל - 2014חשבון נפש: מצב לימודי המתמטיקה בישראל - 2014
חשבון נפש: מצב לימודי המתמטיקה בישראל - 2014
 
Tudatos márkaépítés
Tudatos márkaépítésTudatos márkaépítés
Tudatos márkaépítés
 

Similar to Plugin For Unity

SharePoint Saturday Belgium 2014 - Production debugging of SharePoint applica...
SharePoint Saturday Belgium 2014 - Production debugging of SharePoint applica...SharePoint Saturday Belgium 2014 - Production debugging of SharePoint applica...
SharePoint Saturday Belgium 2014 - Production debugging of SharePoint applica...BIWUG
 
Developing On the IntelliJ Platform
Developing On the IntelliJ PlatformDeveloping On the IntelliJ Platform
Developing On the IntelliJ PlatformYann Cébron
 
Typhoon Managed Execution Toolkit
Typhoon Managed Execution ToolkitTyphoon Managed Execution Toolkit
Typhoon Managed Execution ToolkitDimitry Snezhkov
 
Adding Love to an API (or How to Expose C++ in Unity)
Adding Love to an API (or How to Expose C++ in Unity)Adding Love to an API (or How to Expose C++ in Unity)
Adding Love to an API (or How to Expose C++ in Unity)Unity Technologies
 
Program Verification / Automated Theorem Proving
Program Verification / Automated Theorem ProvingProgram Verification / Automated Theorem Proving
Program Verification / Automated Theorem Provinglokeshwer2
 
MSMDC_CLI363
MSMDC_CLI363MSMDC_CLI363
MSMDC_CLI363mokacao
 
Compilation Of C/C++ program in Android
Compilation Of C/C++ program in AndroidCompilation Of C/C++ program in Android
Compilation Of C/C++ program in Androidrahulverma1080
 
Introduction to MonoTouch
Introduction to MonoTouchIntroduction to MonoTouch
Introduction to MonoTouchJonas Follesø
 
Debot android debugging library
Debot android debugging libraryDebot android debugging library
Debot android debugging libraryTomoaki Imai
 
iOS and Android Development with Unity3D
iOS and Android Development with Unity3DiOS and Android Development with Unity3D
iOS and Android Development with Unity3DRalph Barbagallo
 
Radu vunvulea building and testing windows 8 metro style applications using ...
Radu vunvulea  building and testing windows 8 metro style applications using ...Radu vunvulea  building and testing windows 8 metro style applications using ...
Radu vunvulea building and testing windows 8 metro style applications using ...Radu Vunvulea
 
C++ in windows phone apps
C++ in windows phone appsC++ in windows phone apps
C++ in windows phone appsMirco Vanini
 
iOS,From Development to Distribution
iOS,From Development to DistributioniOS,From Development to Distribution
iOS,From Development to DistributionTunvir Rahman Tusher
 

Similar to Plugin For Unity (20)

SharePoint Saturday Belgium 2014 - Production debugging of SharePoint applica...
SharePoint Saturday Belgium 2014 - Production debugging of SharePoint applica...SharePoint Saturday Belgium 2014 - Production debugging of SharePoint applica...
SharePoint Saturday Belgium 2014 - Production debugging of SharePoint applica...
 
Csharp dot net
Csharp dot netCsharp dot net
Csharp dot net
 
Developing On the IntelliJ Platform
Developing On the IntelliJ PlatformDeveloping On the IntelliJ Platform
Developing On the IntelliJ Platform
 
Typhoon Managed Execution Toolkit
Typhoon Managed Execution ToolkitTyphoon Managed Execution Toolkit
Typhoon Managed Execution Toolkit
 
CFInterop
CFInteropCFInterop
CFInterop
 
Adding Love to an API (or How to Expose C++ in Unity)
Adding Love to an API (or How to Expose C++ in Unity)Adding Love to an API (or How to Expose C++ in Unity)
Adding Love to an API (or How to Expose C++ in Unity)
 
Xamarin - Beyond the Basics
Xamarin - Beyond the BasicsXamarin - Beyond the Basics
Xamarin - Beyond the Basics
 
Program Verification / Automated Theorem Proving
Program Verification / Automated Theorem ProvingProgram Verification / Automated Theorem Proving
Program Verification / Automated Theorem Proving
 
MSMDC_CLI363
MSMDC_CLI363MSMDC_CLI363
MSMDC_CLI363
 
Compilation Of C/C++ program in Android
Compilation Of C/C++ program in AndroidCompilation Of C/C++ program in Android
Compilation Of C/C++ program in Android
 
Introduction to MonoTouch
Introduction to MonoTouchIntroduction to MonoTouch
Introduction to MonoTouch
 
Debot android debugging library
Debot android debugging libraryDebot android debugging library
Debot android debugging library
 
iOS and Android Development with Unity3D
iOS and Android Development with Unity3DiOS and Android Development with Unity3D
iOS and Android Development with Unity3D
 
Radu vunvulea building and testing windows 8 metro style applications using ...
Radu vunvulea  building and testing windows 8 metro style applications using ...Radu vunvulea  building and testing windows 8 metro style applications using ...
Radu vunvulea building and testing windows 8 metro style applications using ...
 
C# Application lifecycle
C# Application lifecycleC# Application lifecycle
C# Application lifecycle
 
Android class provider in mumbai
Android class provider in mumbaiAndroid class provider in mumbai
Android class provider in mumbai
 
C++ in windows phone apps
C++ in windows phone appsC++ in windows phone apps
C++ in windows phone apps
 
iOS,From Development to Distribution
iOS,From Development to DistributioniOS,From Development to Distribution
iOS,From Development to Distribution
 
Intro to .NET and Core C#
Intro to .NET and Core C#Intro to .NET and Core C#
Intro to .NET and Core C#
 
C# everywhere
C# everywhereC# everywhere
C# everywhere
 

Recently uploaded

Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 

Recently uploaded (20)

Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 

Plugin For Unity

  • 2. What is Plugin? • Libraries of native code written in C, C++, Objective-C,….etc • Allow your game code to call functions from these libraries
  • 3. Why do you need to develop a Plugin? • Unity3D can’t Do That • Reuse C/C++/Objective-C components • Difficult customize in Unity3D Assets Store • Cross-Device • Cross-Platform • Security Issues

  • 4. Plugins for Different Device • iOS #if UNITY_IOS #else
 #endif if (Application.platform == RuntimePlatform.IPhonePlayer) • Android #if UNITY_ANDROID #else
 #endif if (Application.platform == RuntimePlatform.Android)
  • 5. iOS Plugins • C/C++ Native Functions in xxx.mm extern “C”{ float ReturnFloat() { return 10.5; } } • C# Dll Import
 using System.Runtime.InteropServices; [DllImport("__Internal")] public static extern float ReturnFloat();
  • 6. iOS Plugins • C/C++ Native Functions in xxx.h void UnitySendMessage(const char* obj, const char* method, const char* msg); • C/C++ Native Functions in xxx.mm extern “C”{ void UnityMessage(char* obj, char* function, char* message){ UnitySendMessage(obj, function, message);} } • C# Dll Import
 using System.Runtime.InteropServices; [DllImport("__Internal")] public static extern float UnityMessage(string obj, string function, string message);
  • 7. Android Plugins • C/C++ Native Functions in xxx.mm extern “C”{ float ReturnFloat() { return 10.5; } } • C# Dll Import
 using System.Runtime.InteropServices; [DllImport("__Internal")] public static extern float ReturnFloat();
  • 8. Android Plugins • Jave Class public class PlugInBridge{ public static float ReturnFloat() { return 10.5f; } } • C#
 AndroidJNI.AttachCurrentThread(); AndroidJavaClass androidClass = new AndroidJavaClass ("com.example.unityplugin.PlugInBridge"); Debug.Log(androidClass.CallStatic< float >(“ReturnFloat"));
  • 9. Android Plugins • Overwrite onActivityResult public class FTUnityPlayerActivity extends UnityPlayerActivity { public void onActivityResult(int requestCode, int resultCode, Intent data) { Log.d("FTUnityPlayerActivity", "onActivityResult: requestCode: " + requestCode + ", resultCode:" + resultCode); } }
  • 10. Android Plugins • Modify your Manifest.xml Automatically <activity android:name="com.example.unityplugin.FTUnityPlayerActivity" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>