Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class inputmouse : MonoBehaviour {
- string teks1,teks2,teks3,teks4;
- int jmlScrol;
- float delta;
- // Use this for initialization
- void Start () {
- jmlScrol=0;
- }
- // Update is called once per frame
- void Update () {
- if(Input.GetKey(KeyCode.Mouse0)){
- teks1 = "Mouse: Klik Kiri";
- }else if(Input.GetMouseButton(1)){
- teks1 = "Mouse: Klik Kanan";
- }
- teks2 = "Position: "+ Input.mousePosition.ToString();
- if(Input.mouseScrollDelta.y > 0){
- delta = Input.mouseScrollDelta.y;
- jmlScrol++;
- }else if(Input.mouseScrollDelta.y < 0){
- delta = Input.mouseScrollDelta.y;
- jmlScrol--;
- }
- teks3 = "Scroll: "+delta.ToString();
- teks4 = "Jumlah Scroll: "+jmlScrol.ToString();
- }
- void OnGUI(){
- GUILayout.BeginArea(new Rect(10,15,400,200));
- GUILayout.Label(teks1);
- GUILayout.Label(teks2);
- GUILayout.Label(teks3);
- GUILayout.Label(teks4);
- GUILayout.EndArea();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment