I’m trying to make a musical game,and right now trying to implement long notes(the ones you have to hold a button from the entire note,but the script i created dont work,it doenst show any error,just dont work.
bool squee2 = false;
bool a = false;
void Update(){
if (Input.GetKey("up")&& a == true ){
squee2 = true;
}
if (Input.GetKeyUp("up")){
squee2 = false;;
sistema.score -= 1;
}
}
void OnTriggerEnter(Collider other) {
a = true;
}
void OnTriggerExit(Collider other) {
a = false;
if (squee2 == true) {
// do stuff
Could you be a little more specific? What's going on in your scene? What objects in the scene are relevant to the problem, and what components are attached to those objects? What do you expect to happen that isn't? Is the collision event missing? Is the logic failing?
– rutterI have a very long object that moves from right to left and another static object in the center of the screen who is the trigger,i need a way to check if the player is holding a key when it enters the trigger,if he dont stopeds pressing the key while inside trigger,and is still holding the button when my object leaves the trigger.
– MetalLord