Re: [DB-AL] Molette souris inutilisable en build
Publié : 01 Mai 2020 09:26
Le forum de la communauté francophone d'Unity
http://www.unity3d-france.com/unity/phpBB3/
http://www.unity3d-france.com/unity/phpBB3/viewtopic.php?f=89&t=17720
Code : Tout sélectionner
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class dededede : MonoBehaviour
{
float scrollInput;
float max = 0.0f;
float min = 0.0f;
float LastScroll = 0.0f;
float ScrollTime = 0.0f;
void Update()
{
ScrollTime += Time.deltaTime;
if (Input.GetAxis("Mouse ScrollWheel") != 0 )
{
scrollInput = (1.0f / ScrollTime) * Mathf.Sign(Input.GetAxis("Mouse ScrollWheel")) * Time.deltaTime;
ScrollTime = 0.0f;
LastScroll = scrollInput;
max = Mathf.Max(max, scrollInput);
min = Mathf.Min(min, scrollInput);
}
else
{
scrollInput = 0.0f;
}
}
void OnGUI()
{
GUI.Label(new Rect(10, 10, 150, 20), scrollInput.ToString("f2") + " : Scrool Input");
GUI.Label(new Rect(10, 20, 150, 20), LastScroll.ToString("f2") + " : Dernier Scroll");
GUI.Label(new Rect(10, 30, 150, 20), max.ToString("f2")+ " : Scroll Max");
GUI.Label(new Rect(10, 40, 150, 20), min.ToString("f2")+ " : Scroll Min");
}
}