Skip to content

Commit 515a296

Browse files
committed
Fix script define for native tools
1 parent fc80d3d commit 515a296

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

Assets/Plugins/WebGL/WebTools/EventListeners/WebEventListeners.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ namespace Supyrb
1818
public class WebEventListeners : MonoBehaviour
1919
{
2020

21-
#if UNITY_WEBGL
21+
#if UNITY_WEBGL && !UNITY_EDITOR
2222
[DllImport("__Internal")]
2323
private static extern void _AddJsEventListener(string eventName);
24-
#endif
24+
#endif
2525
private const string GameObjectName = "WebEventListeners";
2626

2727
private Dictionary<string, WebEventListener> eventListeners = new Dictionary<string, WebEventListener>();
@@ -55,9 +55,11 @@ private void AddEventListenerInternal(string eventName, Action callback)
5555
eventListeners[eventName] = eventComponent;
5656
eventComponent.OnEvent += callback;
5757

58-
#if UNITY_WEBGL
58+
#if UNITY_WEBGL && !UNITY_EDITOR
5959
// Add event listener on javascript side
6060
_AddJsEventListener(eventName);
61+
#elif UNITY_EDITOR && WEBTOOLS_LOG_CALLS
62+
Debug.Log($"<color=#00CCCC>{nameof(WebEventListeners)}.{nameof(AddEventListenerInternal)} add callback for {eventName}</color>");
6163
#endif
6264
}
6365
}

Assets/Plugins/WebGL/WebTools/WebToolPlugins.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace Supyrb
1919
{
2020
public static class WebToolPlugins
2121
{
22-
#if UNITY_WEBGL
22+
#if UNITY_WEBGL && !UNITY_EDITOR
2323
[DllImport("__Internal")]
2424
private static extern void _SetStringVariable(string variableName, string variableValue);
2525
[DllImport("__Internal")]

0 commit comments

Comments
 (0)