Advertisement
Guest User

Untitled

a guest
Mar 28th, 2015
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3. using System;
  4. using System.Runtime.InteropServices;
  5.  
  6. public class PluginImport : MonoBehaviour {
  7. //Lets make our calls from the Plugin
  8. [DllImport ("ASimplePlugin")]
  9. private static extern int PrintANumber();
  10.  
  11. [DllImport ("ASimplePlugin")]
  12. private static extern IntPtr PrintHello();
  13.  
  14. [DllImport ("ASimplePlugin")]
  15. private static extern int AddTwoIntegers(int i1,int i2);
  16.  
  17. [DllImport ("ASimplePlugin")]
  18. private static extern float AddTwoFloats(float f1,float f2);
  19.  
  20. void Start () {
  21. Debug.Log(PrintANumber());
  22. Debug.Log(Marshal.PtrToStringAnsi (PrintHello()));
  23. Debug.Log(AddTwoIntegers(2,2));
  24. Debug.Log(AddTwoFloats(2.5F,4F));
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement