Skip to content

Instantly share code, notes, and snippets.

@gtk2k
Created March 26, 2021 11:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gtk2k/db31c545cb0906061b24d785d50a5703 to your computer and use it in GitHub Desktop.
Save gtk2k/db31c545cb0906061b24d785d50a5703 to your computer and use it in GitHub Desktop.
jslib_test_snippet.cs
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