Hi all. I have a project that I made for desktop (Windows), but I recently tried it out on my Surface Pro tablet and realised how enjoyable it is to use it with the stylus. The problem is that a certain functionality is no longer working.
I have a static image of a control surface as the background; i.e., it's a picture of knobs and buttons. In front of this I have a rectangular mesh for each button, with visibility off, with the following script:
using UnityEngine;
using System.Collections;
public class focus : MonoBehaviour {
public static bool isUsing;
void Start () {
renderer.enabled = false;
isUsing = false;
}
void Update () {
if( isUsing ){
if(Input.GetAxis("Mouse Y") > 0){
OtherScript.Value = OtherScript.deltaValue*(Time.deltaTime);//Time.deltaTime/100000;
}
if(Input.GetAxis("Mouse Y") < 0){
OtherScript.Value -= OtherScript.deltaValue*(Time.deltaTime);//Time.deltaTime/100000;
}
}
if(Input.GetMouseButtonUp(0)){
isUsing = false;
}
}
void OnMouseOver(){
if(Input.GetMouseButtonDown(0))
isUsing = true;
}
}
What this does is change Value
up or down when the mouse is moved up or down, respectively, while the mouse button is held down over the control knob. The trouble is that it doesn't work with the stylus. As far as I can tell, it is the
if(Input.GetAxis("Mouse Y") > 0)
and
if(Input.GetAxis("Mouse Y") < 0)
conditionals that aren't working. Does anyone have any idea what the easiest way to get this working with the stylus would be?
tl:dr: Input.GetAxis("Mouse Y")
does not appear to work with the stylus on Surface Pro. How can I get my desktop project to work with both mouse and stylus?
Post Details
- Posted
- 9 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/Unity3D/com...