the input escape key cancel function works but the bool function i added to determine if the key is being pressed twice to enable / disable player movement for my menu ui. does not.
any ideaS ?
anyone have any idea why this doesn’t work
if I remove the second bool “not moving” it works but with both of them in the script nothing happens when I press the escape key.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class menu : MonoBehaviour
{
public bool IsMoving;
public bool NotMoving;
// Start is called before the first frame update
void Start()
{
IsMoving = true;
NotMoving = false;
}
// Update is called once per frame
void Update()
{
if (Input.GetButtonDown("Cancel"))
{
if (IsMoving)
{
GetComponent<SC_FPSController>().enabled = false;
NotMoving = true;
IsMoving = false;
}
if(NotMoving)
{
GetComponent<SC_FPSController>().enabled = true;
IsMoving = true;
NotMoving = false;
}
}
}
Myles Calladine is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.