Detect multiple keys pressed together unity tutorial
Code:
//ASSALAM o alaikum
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class MultipleKeysPress : MonoBehaviour
{
public Text messageText; // Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if (Input.GetKey(KeyCode.A) &&Input.GetKey(KeyCode.B))
{
messageText.text = "A and B pressed together";
}
else messageText.text="";
}
}
Video Link :
No comments:
Post a Comment