Answers for "how to check if a key was pressed in unity"

17

how to check if object has key javascript

myObj.hasOwnProperty('key') // it checks object for particular key and not on prototype
Posted by: Guest on March-28-2020
4

unity when key pressed

void Update()
    {
        if (Input.GetKeyDown("space"))
        {
            print("space key was pressed");
        }
    }
Posted by: Guest on February-14-2021
8

unity check if key pressed

if (Input.GetKeyDown(KeyCode.KEY))
Posted by: Guest on June-15-2020
3

unity check when clicked on object

void Update()
{
  // Check for mouse input
  if (Input.GetMouseButton(0))
  {
  	Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
   	RaycastHit hit;
   	// Casts the ray and get the first game object hit
   	Physics.Raycast(ray, out hit);
   	Debug.Log("This hit at " + hit.point );
  }
}
Posted by: Guest on March-27-2020
0

delphi check if key pressed is enter

procedure TForm1.Memo1KeyPress(Sender: TObject; var Key: Char);
begin
  if Key = #13 then
  begin
    // Do something
  end;
end;
Posted by: Guest on April-06-2020

Code answers related to "how to check if a key was pressed in unity"

Code answers related to "Javascript"

Browse Popular Code Answers by Language