- Home /
Question by
DeltaCharlie13 · Apr 17, 2015 at 03:24 PM ·
webplayerscrollviewdropboxscrollwheel
Scroll not working in web player
Hi,
The scroll function is working in Unity but not on the web player, it scrolls the web page instead. Here is my code:
using UnityEngine;
using System.Collections;
public class Scroll : MonoBehaviour {
//scroll variable
public Vector2 scrollPosition = Vector2.zero;
//inside variables
private string textFieldString = "text field";
private string textAreaString = "text area";
void OnGUI (){
//the scroll area
scrollPosition = GUI.BeginScrollView (new Rect (20, 20, 900, 600), scrollPosition, new Rect (0, 0, 0, 2000));
//inside text fields
textFieldString = GUI.TextField (new Rect (10, 25, 100, 30), textFieldString, 25); //end number is limit
textAreaString = GUI.TextArea (new Rect (10, 100, 100, 100), textAreaString, 250);
//inside labels
GUI.Label (new Rect (10, 1400, 100, 100), textFieldString);
GUI.Label (new Rect (10, 1500, 100, 100), textAreaString);
//end scroll area
GUI.EndScrollView ();
}
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
float scroll = Input.GetAxis("Mouse ScrollWheel"); if (scroll != 0.0f) Debug.Log("MouseScroll: " + scroll); //scroll debug
}
}
Im using a magic mouse, which I hear has issues so I debugged the scroll and it works fine in unity, just not on the web player which is being hosted on dropbox, any help appreciated! :D
Thanks
Liam
Comment
Seems this is a bug in Google Chrome, can anyone confirm?
Answer by Worrier.Po · Oct 08, 2015 at 08:52 PM
unity don't support Input.GetAxis("Mouse ScrollWheel") in webgl.
Dunno if that is outdated but scroll wheel does work in webGl.