It works on everything else but when I make it into WebGL build click does not work Any help would be nice Thanks Code (CSharp): using UnityEngine; using System.Collections; using System; public class InputManager : MonoBehaviour { public static event Action<Vector2> OnTouchDownEvent; public static event Action<Vector2> OnTouchUpEvent; public static event Action<Vector2> OnMouseDownEvent; public static event Action<Vector2> OnMouseUpEvent; public static event Action OnBackButtonPressedEvent; void Update() { #if (UNITY_ANDROID || UNITY_IOS || UNITY_WP8) && !UNITY_EDITOR foreach(Touch t in Input.touches) { switch(t.phase) { case TouchPhase.Began : if(OnTouchDownEvent != null) { OnTouchDownEvent(t.position); } break; case TouchPhase.Stationary : break; case TouchPhase.Canceled : case TouchPhase.Ended : if(OnTouchUpEvent != null) { OnTouchUpEvent(t.position); } break; } } #endif if(Input.GetKeyDown(KeyCode.Escape)) { if(OnBackButtonPressedEvent != null) { OnBackButtonPressedEvent(); } } } void OnGUI() { #if UNITY_EDITOR || UNITY_METRO || UNITY_STANDALONE || UNITY_WEBPLAYER if(Event.current.type == EventType.MouseDown) { if(OnMouseDownEvent != null) { OnMouseDownEvent(Input.mousePosition); } } if(Event.current.type == EventType.MouseUp) { if(OnMouseUpEvent != null) { OnMouseUpEvent(Input.mousePosition); } } #endif } }
If we take out the defines you end up with this: Code (CSharp): using UnityEngine; using System.Collections; using System; public class InputManager : MonoBehaviour { public static event Action<Vector2> OnTouchDownEvent; public static event Action<Vector2> OnTouchUpEvent; public static event Action<Vector2> OnMouseDownEvent; public static event Action<Vector2> OnMouseUpEvent; public static event Action OnBackButtonPressedEvent; void Update() { if(Input.GetKeyDown(KeyCode.Escape)) { if(OnBackButtonPressedEvent != null) { OnBackButtonPressedEvent(); } } } void OnGUI() { } } So as I read it only your escape key should work on WebGL. Seems to be working as written.
This was a asset on the store the publisher has says he is going to post a update but that was a month ago