- Home /
 
               Question by 
               Squitz · Nov 15, 2019 at 09:21 PM · 
                2dinputgrid based gamepuzzlemoveposition  
              
 
              Keyboard not working in build (is working in editor)
Hi After I made a little change to my controls (made them better) And i build my project. My keyboard input is not working anymore. I don't know how or why. And any of the solutions on the internet don't work. Please help public bool IsO = false; public Rigidbody2D rbYellow; //rigidbody of object it is on public Animator ani; float timer;
     private void OnMouseDown()
     {
         if (Input.GetMouseButtonDown(0))
         {
             foreach(Collisions_Yellow obj in FindObjectsOfType<Collisions_Yellow>())
             {
                 obj.selected(false);
             }
             selected(true);
         }
     }
 
     void Update()
     {
         rbYellow.position = new Vector2(Mathf.Round(transform.position.x),Mathf.Round(transform.position.y));
 
         if(IsO && !won_canvas.won && timer <= 0)
         {
             if (Input.GetKey(KeyCode.Z) || Input.GetKey(KeyCode.UpArrow))
             {
                 rbYellow.MovePosition(new Vector2(transform.position.x, transform.position.y+1)); timer = 0.15f;
             }
             if (Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.DownArrow))
             {
                 rbYellow.MovePosition(new Vector2(transform.position.x, transform.position.y - 1)); timer = 0.15f;
             }
             if (Input.GetKey(KeyCode.Q) || Input.GetKey(KeyCode.LeftArrow))
             {
                 rbYellow.MovePosition(new Vector2(transform.position.x-1, transform.position.y)); timer = 0.15f;
             }
             if (Input.GetKey(KeyCode.D) || Input.GetKey(KeyCode.RightArrow))
             {
                 rbYellow.MovePosition(new Vector2(transform.position.x+1, transform.position.y)); timer = 0.15f;
             }
         }
         else
         {
             if(timer>0)timer -= Time.deltaTime;
         }
     }
 
     public void selected(bool isSel)
     {
         if (isSel)
         {
             IsO = true;
             ani.SetBool("IsO", true);
             gameObject.GetComponent<AudioSource>().enabled = true;
             gameObject.GetComponent<Rigidbody2D>().bodyType = RigidbodyType2D.Dynamic;
         }
         else
         {
             IsO = false;
             ani.SetBool("IsO", false);
             gameObject.GetComponent<AudioSource>().enabled = false;
             gameObject.GetComponent<Rigidbody2D>().bodyType = RigidbodyType2D.Static;
         }
     }
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                