“Jeśli zdobądź Key Down Unity” Kod odpowiedzi

Wykrywanie klucza jedności

if (Input.GetKeyDown(KeyCode.Space))
        {
            print("space key was pressed");
        }
RyanGar46

Jeśli zdobądź Key Down Unity

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour
{
    void Update()
    {
        if (Input.GetKeyDown("space"))
        {
            print("space key was pressed");
        }
    }
}
Xenophobic Xenomorph

Debug.log (input.getkey)

void Update()
{
    //get the input
    var input = Input.inputString;

    //ignore null input to avoid unnecessary computation
    if (!string.IsNullOrEmpty(input))
    {
        switch(input)
        {
            case 'a': break;
            case 'b': break;
        }
    }
}
Agreeable Addax

Odpowiedzi podobne do “Jeśli zdobądź Key Down Unity”

Pytania podobne do “Jeśli zdobądź Key Down Unity”

Więcej pokrewnych odpowiedzi na “Jeśli zdobądź Key Down Unity” w C#

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu