Created
March 26, 2021 11:08
-
-
Save gtk2k/db31c545cb0906061b24d785d50a5703 to your computer and use it in GitHub Desktop.
jslib_test_snippet.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Runtime.InteropServices; | |
using Unity.Entities; | |
public class ByteArraySystem : SystemBase | |
{ | |
[DllImport("__Internal")] | |
private static extern void binaryInit(byte[] test, int size); | |
[DllImport("__Internal")] | |
private static extern void consoleLog(byte val); | |
byte[] byteArray = new byte[2]; | |
float t = 0; | |
protected override void OnCreate() | |
{ | |
binaryInit(byteArray, byteArray.Length); | |
} | |
protected override void OnUpdate() | |
{ | |
t += Time.DeltaTime; | |
if(t >= 1f) | |
{ | |
t = 0; | |
byteArray[0]++; | |
if (byteArray[0] >= 200) | |
byteArray[0] = 0; | |
} | |
consoleLog(byteArray[1]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment