Thursday, June 5, 2014

How to communicate with "Outer Game Elements"

Okay ! I've got my game running. Its showing Mr. lil' Ratcher jumping on the ledges. And shooting at enemies. Might be some chirping sound coming as well. But wait, I want to send a push notification on my phone/tablet so that I will be informed all time about my game happenings. So a good question comes to my mind !
         How do I communicate to device being inside Unity !
    Well. I looked out for it. And found some decent answers satisfying my queries. We do "NATIVE CALLING" inside Unity. You can see them as a event triggers. Yeah you can send these triggers to the platform on which Unity is running like IOS, Windows, Android , etc. Okay. Don't be impatient. Let me share a screenshot with you where i'm declaring all the functions related to native calling. They are written under device dependent condition. 


































Here its how i'm testing my native call to the device. I took a reference of the "nativecall" script and called the TestConnection function with the default parameter. 



Hence you can call the respective native side according to the parameters your have sent from Unity. And yeah Voila ! We did it ! :D 

No comments:

Post a Comment