I have searched and seen several answers, but i cant get it to work. The code wont print the button up message, so i assume that i am missing something.
I am trying to make a function for Interaction and when you release the button it should confirm your choice of action. Similar to a weapon selection wheel.
Update
void Update()
{
switch (isAiUnit)
{
case true:
{
AiInput();
}
break;
case false:
{
PlayerInput();
}
break;
}
}
void PlayerInput()
{
if(Input.GetKey(KeyCode.E))
{
if(Input.GetKeyDown(KeyCode.E))
{
interactionTimeStart = Time.time;
}
InteractionInput(interactionTimeStart);
}
}
void InteractionInput(float timeStart)
{
Debug.Log(" Button Down " + (Time.time - timeStart));
if (Input.GetKeyUp(KeyCode.E) && ((Time.time - timeStart) > 0.25f))
{
Debug.Log(" ButtonUp ");
}
}