using UnityEngine;
public class Sneak : MonoBehaviour
{
public Transform player;
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.LeftShift))
{
player.localScale = new Vector3(1,0.5f,1);
}
if (Input.GetKeyDown(KeyCode.LeftShift))
{
player.position = new Vector3(player.position.x, player.position.y -0.25f, player.position.z);
}
if (Input.GetKeyDown(KeyCode.LeftShift))
{
player.localScale = new Vector3(1, 1, 1);
}
}
}
So i want the player to become sneaked when u press Left Shift, and then still be sneaked when its not pressed anymore, but for him to unsneak hed need to press left shift after already pressing it to become sneaked, How would u do this? Because with this code he just sneaks and unsneaks quickly when i pressed left shift. (sorry if this is dumb question im new to C# and Unity)