title: Unity WebGL Slider in world space
body: <p>How to make a UI slider work for WebGL build for a unity project ?</p>
  <p>This is how I made the button work. So this a webgl build and canvas is world space.
  Also, not able to add XR interaction toolkit through package manager.
  Details:</p>
  <p>Unity : 2021</p>
  <pre><code>[RequireComponent(typeof(Collider))]
  public class Mesh[enter image description here][1]Button : MonoBehaviour
  {
      public GameObject highlightedMesh;
      public GameObject pressedMesh;
      public GameObject normalMesh;
          
      public UnityEvent mouseHover;
      public UnityEvent mousePressed;
      public UnityEvent mouseExit;
  
      private void Start()
      {
          highlightedMesh.SetActive(false);
          pressedMesh.SetActive(false);
          normalMesh.SetActive(true);
      }
  
      public void OnHover()
      {
          highlightedMesh.SetActive(true);
          pressedMesh.SetActive(false);
          normalMesh.SetActive(false);
      }
      
      public void OnPressed()
      {
          highlightedMesh.SetActive(false);
          pressedMesh.SetActive(true);
          normalMesh.SetActive(false);
  
  
  
      }
  
      public void OnExit()
      {
          [enter image description here][1]highlightedMesh.SetActive(false);
          pressedMesh.SetActive(false);
          normalMesh.SetActive(true);
      }
      
      private void OnMouseOver()
      {
          mouseHover.Invoke();
      }
  
      private void OnMouseDown()
      {
          mousePressed.Invoke();
      }
  
      private void OnMouseExit()
      {
          mouseExit.Invoke();
      }
  }
  </code></pre>