Cube.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.Runtime.InteropServices;
  5. public class Cube : MonoBehaviour
  6. {
  7. [DllImport("__Internal")]
  8. private static extern void Hello();
  9. [DllImport("__Internal")]
  10. private static extern void HelloString(string str);
  11. [DllImport("__Internal")]
  12. private static extern void PrintFloatArray(float[] array, int size);
  13. [DllImport("__Internal")]
  14. private static extern int AddNumbers(int x, int y);
  15. [DllImport("__Internal")]
  16. private static extern string StringReturnValueFunction();
  17. [DllImport("__Internal")]
  18. private static extern void BindWebGLTexture(int texture);
  19. [System.Obsolete]
  20. void Start() {
  21. Hello();
  22. HelloString("This is a string.");
  23. float[] myArray = new float[10];
  24. PrintFloatArray(myArray, myArray.Length);
  25. int result = AddNumbers(5, 7);
  26. Debug.Log(result);
  27. Debug.Log(StringReturnValueFunction());
  28. var texture = new Texture2D(0, 0, TextureFormat.ARGB32, false);
  29. BindWebGLTexture(texture.GetNativeTextureID());
  30. }
  31. }