Hi all, I need to know how I can get the WASD keys (pressed separately to activate 2 gameobjects). For example, when W is pressed complete the activation of gameobjects. When A is pressed activate them again. (not all at the same time)
All I can find and do is get when 1 key is pressed or when multiple keys are pressed at the same time. This is not what I want.
Here is my script so far:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class WASDAnim : MonoBehaviour
{
public GameObject IdleAnimation;
public GameObject RunAnimation;
void Update()
{
if (Input.GetKey(KeyCode.W))
{
IdleAnimation.SetActive(false);
RunAnimation.SetActive(true);
}
else
{
IdleAnimation.SetActive(true);
RunAnimation.SetActive(false);
}
}
}
Any help would be highly appreciated!