Skip to content

Instantly share code, notes, and snippets.

@douglastaquary
Created May 29, 2018 16:46
Show Gist options
  • Save douglastaquary/854273f4ca64de812d99df9c4d64ca5f to your computer and use it in GitHub Desktop.
Save douglastaquary/854273f4ca64de812d99df9c4d64ca5f to your computer and use it in GitHub Desktop.
C# file - NativeBridge - BoomExample
using System.Runtime.InteropServices;
using UnityEngine;
using UnityEngine.UI;
public class NativeBridge : MonoBehaviour {
[SerializeField]
private MeuComponente meucomponente;
#if UNITY_IOS && !UNITY_EDITOR
[DllImport("__Internal")]
private extern static void sendMessage(string boomText);
#else
private void sendMessage(string boomText) {
showMessage(boomText);
}
#endif
private void showMessage(string displayText) {
meuComponente.text = displayText;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment