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 Simmind · Jan 28, 2016 at 01:28 PM · c#inputunity5keyboard

Can § be used as input?

Hey,

I try to use "§"(under"Esc", next to "1") key as input, so player could stop "game time", not "Unity time". Meaning that by pressing "§" player could toggle, for example some scripts but keep Unity running.

Yes, I could use some other key on keyboard but "§,1,2,3" seems most logical: § = stop, 1 = slow, 2 = medium, 3 = fast.

Here is something that I tried:

void Update () {

     if (Input.GetKeyDown(KeyCode.§)){
         Debug.Log ("§ pressed");
     }
     if (Input.GetAxis ("§") != 0){
         Debug.Log ("§ axis");
     }
 }

First problem is "KeyCode.§". I get Parser Error: Unexpected character "§".

Well I made new axis. Edit - Project Settings -Input.

Now I try "§" key as any input (negative, positive, alternative). I get "§" there but when I click something else it disappears.

Is "§" key hard coded in way that it can´t be input?

If I can get at least one Debug.Log message I could continue.

Any help is welcome.

Thanks ahead community.

Ps. Tell me if this should be some were else that here in Ask&Answer

Here is my feedback suggestion to Unity: (sharing should help)

https://feedback.unity3d.com/suggestions/more-keyboard-layouts-to-input-mapping

Comment
Add comment · Show 1
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
avatar image Simmind · Jan 29, 2016 at 08:18 AM 0
Share

Difference between standard PC QWERTY and PC QWERTY Nordic keyboards, most likely.

Hoping that Unity could have feature/asset that we could map different keyboard -layouts if there is conflict on standard mapping.

I can do work around using "Esc" as pause and then let player chose for going menu or continue or design-mode so on and so on.

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by tanoshimi · Jan 28, 2016 at 02:35 PM

Can't say I've ever seen that symbol on a keyboard before, but no, it's not a recognised input key. Here's the supported values -

http://docs.unity3d.com/ScriptReference/KeyCode.html

Comment
Add comment · Show 7 · Share
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
avatar image Simmind · Jan 29, 2016 at 07:43 AM 0
Share

Thanks for link. It will help people with similar problem. I checked that out already before I send question. But good call.

I realize that my keyboard is "PC QWERTY Nordic" so this might be just that. By "Nordic" I mean that we have "A-Z and ÅÄÖ"letters so my keyboard is slightly different that standard "PC QWERTY" but it is still fairly commonly used in Finland, Sweden, Norway, Denmark, Iceland and rarely used around world.

Could Unity have feature/asset for cross-keyboard mapping? $$anonymous$$eaning that in Unity editor you could see different type of keyboards and map keys based on those. $$anonymous$$ap input keys for each type of keyboard. Simple, visual and easy.

avatar image tanoshimi · Jan 29, 2016 at 08:54 AM 0
Share

What value do you get from inputString on pressing the key? I suspect not anything as it's a non-ascii character, but worth a try?

http://docs.unity3d.com/ScriptReference/Input-inputString.html

avatar image Simmind · Jan 29, 2016 at 10:03 AM 0
Share

void Update () { foreach (char c in Input.inputString) { Debug.Log (c); } }

Console prints "§"-mark as well as any other character, letter, number.

Hmm... is this red from Win / Operating System.

avatar image tanoshimi Simmind · Jan 29, 2016 at 11:54 AM 0
Share

In that case you've got a solution, right?

ins$$anonymous$$d of:

 if (Input.Get$$anonymous$$eyDown($$anonymous$$eyCode.§)){
      Debug.Log ("§ pressed");
  }

you use:

 if(Input.inputString == "§")){
   Debug.Log("§ pressed");
 }
avatar image Simmind tanoshimi · Feb 01, 2016 at 12:24 PM 0
Share

Well yeah, it works. Thanks! But if player holds §-key down:

{if (Input.inputString == "§" && bool) { bool = false;}

else if (Input.inputString == "§" && !bool){ bool = true;}}

Now it toggles every frame, pause or unpause, if § is pressed. I didn´t find similar to $$anonymous$$eyDown version for inputString. Can inputString be made "manually" work only for one frame? even if key is holded down?

Show more comments
avatar image Simmind · Feb 02, 2016 at 11:50 AM 0
Share

Going here now.

string lastPressed;

void Start(){

string lastPressed = "";

}

void Update() {

if(Input.inputString == "§" && lastPressed != "§")){ Debug.Log ("§ pressed this frame"); }

else { Debug.Log ("Not § pressed this frame"); }

lastPressed = Input.inputString;

}

Not pressing §, console = Not § pressed this frame; Ok

Pressing §, console = Both messages game; not Ok

I tried with more experienced college to solve this issue. No solid fix or work around found. If using different key is not option.

avatar image
0

Answer by FortisVenaliter · Jan 28, 2016 at 04:09 PM

Looks like that symbol is only available in European Macs, so Unity does not have native support for it. You might try the standard PC QWERTY equivalent, (which is '`' or '~') and see if Unity recognizes it as such.

Comment
Add comment · Show 1 · Share
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
avatar image Simmind · Jan 29, 2016 at 07:58 AM 0
Share

Thanks for your time and effort. I commented to tanoshimi answer and I hope you could check that out as well, mainly for more info.

I thank for equivalents, '`' is under Shift+` and '~' is under Ctrl+Alt+¨.

$$anonymous$$y keyboard is "PC QWERTY Nordic" model, extra ÅÄÖ-letters, so there is some differences to standard PC QWERTY.

Could Unity have feature/asset for cross-keyboard mapping? $$anonymous$$eaning that in Unity editor you could see different type of keyboards and map keys based on those. $$anonymous$$ap input keys for each type of keyboard. Simple, visual and easy.

avatar image
0

Answer by ForbiddenSoul · Jan 29, 2016 at 08:55 AM

The "§" symbol is a "`" symbol on every PC keyboard I've seen. They key that usually opens up the console for games. Anyways you can probably use it with KeyCode.BackQuote

 Input.GetKeyDown(KeyCode.BackQuote)
Comment
Add comment · Show 1 · Share
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
avatar image Simmind · Jan 29, 2016 at 10:19 AM 0
Share

Sadly not getting response. Not on § or Shift+´ or ´. I also tried all combination I came up with. But thanks for your time and effort.

In example GTAV "§" does open console. So you got that right.

Going to try $$anonymous$$eyCode."different symbols".

I press "´" nothing happens before I press it again, now there is two of them. Or once Quote and then "e" or "t" I get "é" or "´t".

Hmm... if you could press Quote or BackQuote once in Text field like this comment, do you get nothing or one Quote? Possible feature on Nordic keyboard?

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

6 People are following this question.

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

Related Questions

Can you simulate key press within WebView? 0 Answers

Multiple Cars not working 1 Answer

NGUI UIInput issue with some Android devices (Virtual keyboard is OK, but no letters appears on textfield) 0 Answers

Input system looses keypress after a few frames [BUG?] 0 Answers

Key not recognized 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