Verified Commit 9aab4651 authored by Sebastian Höffner's avatar Sebastian Höffner
Browse files

Avoiding jslib-related errors when in UnityEditor (where jslib is not used)

parent 6baee46e
......@@ -13,16 +13,18 @@ namespace dlu
public class DirectCommunication : Communication
{
#if !UNITY_EDITOR
[DllImport("__Internal")]
public static extern void Init();
[DllImport("__Internal")]
public static extern void Reply(byte[] response, int response_length);
#endif
protected override void StartServer()
{
#if !UNITY_EDITOR
Init();
#endif
}
public void PerformRequest(string request) {
......@@ -35,7 +37,11 @@ public class DirectCommunication : Communication
{
string responseString = base.ComposeReply(response, originalRequest);
byte[] responseArray = Encoding.UTF8.GetBytes(responseString);
#if !UNITY_EDITOR
Reply(responseArray, responseString.Length);
#else
Debug.Log("[DirectCommunication] Would reply using jslib");
#endif
yield return null;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment