Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Thomas-Hawk · Jan 07, 2019 at 01:55 AM · inputnot workingkeyboardremotegetkey

SOLVED - After using Unity Remote and accidentally hitting some button in Visual Studio, Input no longer detects keyboard unless the mouse is held down. Please, help.

Hi! I'm a relatively intermediate developer and I'm having a problem that I'm hoping someone here will have an answer for.

I've been porting a lot of code from a PC pet project to Android over my 2 week break which I get once a year!

I have about 9 hours left of my break and, while using Unity Remote to playtest, with everything working fine, I realize a couple hours ago that, even though earlier today it worked, I am no longer getting "Input" events in my script called.

So I add this to the beginning of the update function that was troubling me, ensuring no other variables were affecting it.

   if (Input.GetKeyDown(KeyCode.L))
         {
             print("Pressed L");
         }

I debugged to make sure that update loop was finishing, and it was. I took out all returns / breaks, and still nothing. Input from the Unity Remote still is working in that same update loop. I made a new script, totally new, on an empty gameobject: using System.Collections; using System.Collections.Generic; using UnityEngine;

 public class InputTester : MonoBehaviour
 {
     // Start is called before the first frame update
     void Start()
     {
         
     }
 
     // Update is called once per frame
     void Update()
     {
         if (Input.anyKey)
             print("Hitting some key or another: " + Input.inputString);
     }
 }
 

And here is where it gets interesting. Or confusing. That message only prints for the mouse input. However, if I am holding the mouse input down, it will print for other keys! And while the problematic update is going, even when this script prints that it sees my "L", the first script still doesn't see it.

What could the problem be? I feel like I didn't change anything about those scripts that would make it ignore input. I don't have any classes or behaviours or methods overriding anything similar to "Input". What could be causing this bizarre behaviour? I've restarted Unity, my computer, my Unity Remote phone, tried minimizing and maximizing every which way at the advice of the internet, but still nothing.

Thanks again for any help

Edit: I also just tried deleting everything in my scene except that debug log script. Still, same behaviour.

Edit 2: I made an empty project with "InputTester" and it is working as intended. So, while I wait for a scene to export only to probably produce the same issue, how could I possibly find out what the problem is? What could be taking priority over frikkin' input?

Edit 3: In the new project, I imported my scene, with platform as Windows. Same exact scene as the first project. I run it, and I get input just fine. So I switch my platform to Android and the problem begins again! So I think, huzzah, I have found the issue. But, then I switched back to targeting Windows, and the problem persisted. So, a bug perhaps?

FINAL EDIT / SOLUTION: I guess this is one of those things I'd probably know if I spent more time looking through documentation. I like to learn the hard way I guess.

To target Android in the editor, and use Unity Remote, and have these scripts see your keyboard input, set "Joystick Source" from "Remote" to "Local" under "Edit > Project Settings> Editor / Unity Remote"

So, the obvious "Duh" here is that, since during runtime on Android you typically won't have access to the keyboard in the same capacity, so my case is a bit special in that, I am - possibly in poor practice - relying on a keyboard press to trigger functions for debugging purposes - namely serializing some transform information to be loaded during runtime through script.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

117 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Shift + KeyCode.Equals works in Unity Editor but not on WebGL build 0 Answers

Default Android Keyboard. 0 Answers

Refactor code from getting input from keyboard to get input from UI Buttons 1 Answer

GetKeyDown code turned into a int issue [SOLVED] 1 Answer

How to get the keyboard/OS capsLock state? 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges