Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 marisa3d · Mar 13, 2014 at 01:57 PM · inputmaclinuxenter

Enter and Return in TextField in Mac Not Working

I created a game which teaches the player how to navigate within the Linux file structure. The game works flawlessly on Windows with the Unity Web Player. (Issue #1) However, on a Mac, the commands are never "entered", i.e. although the player can insert a carriage return, it never carries out the command or even prints it in the history console. (Issue #2) Additionally, if anyone can offer advice on how to get this game working for Linux natively (WINE is not the best option) and I've done a "universal 32-64" build for Linux which did not work. The students use CentOS as their Linux distro.

Play the game here: File Fishing

 function OnGUI () {
 
 GUI.skin = linuxSkin;
 
 GUI.Label (prefaceRect, preface, "command");
 GUI.SetNextControlName("CommandLine");
 command = GUI.TextField (commandLineRect, command, 30, "command");
 GUI.FocusControl("CommandLine");
 //create console area
 GUI.SetNextControlName("History");
     scrollPosition = GUI.BeginScrollView (historyLogRect, scrollPosition, scrollViewRect);
     scrollViewRect.height = 17.5 * linesFed;
     GUI.Box(scrollBounds, "");
     
     if (scrollViewRect.Contains(Event.current.mousePosition))
     {
        if (Event.current.type == EventType.MouseDrag)
        {
           scrollPosition.y = Event.current.mousePosition.y;
          // Event.current.Use();
        }
     }
     else {
         scrollPosition.y = scrollViewRect.height;
         }
     
     GUI.Label(scrollViewRect, history, "command");
     
     previousCommand = command;
     GUI.EndScrollView ();
         
 if (Event.current.type == EventType.KeyUp && (Event.current.keyCode == KeyCode.Return || Event.current.keyCode == KeyCode.KeypadEnter || Event.current.character == '\n'))
 {
     scrollPosition.y = scrollViewRect.height;
     invalidCommand = false;
     subCommand = null;
     iter = 0;
     commandBrokenDown = false;
     i = 0;
     for (j=0; j<increment.Length; j++)
     {
         increment[j]=null;
     }
     if (pwd)
     {
         pwd = false;
     }
     history += command;
     linesFed++;
     
     BreakDownCommand();
     if (command.StartsWith("cd") && !invalidCommand)
     {
         CarryOutCommand();
     }
     
     command = "";
     
 
     if (invalidCommand)
     {
         history += "No such directory found.\n";
         linesFed++;
         audio.PlayOneShot(errorSound);
     }
     
     if (remindOfCase)
     {
         history += "Reminder: Linux is case sensitive.\n";
         linesFed += 2;
         audio.PlayOneShot(errorSound);
         remindOfCase = false;
     }
     
 }
 
 
 }


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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by magnusDB · Sep 12, 2014 at 12:56 PM

I have a similar problem with my Linux version. When I try to input the enter key it is printing a weird symbol (like ¬) and is not being 'considered' in the following if statement on the Update function:

 void Update(){
     if( Input.GetKeyDown( KeyCode.KeypadEnter ) || Input.GetKeyDown( KeyCode.Return ) )
         // do something
 }

However, in the Windows version it works just fine.

Furthermore, the Linux version have at least another two problems I could identify - when using Ubuntu 14 and compiling with Unity3D 4.5.3f3:

  • controllers focus problem: In the Windows version, when I select a textfield and type 'w' for example, only the textfield is updated accordingly; in the other hand, in the linux version, besides updating the textfield my avatar also moves;

  • numeric keypad problem: In Linux version when I type a key in the numeric keypad nothing is inserted in a textfield and incorrect characters are inserted in a password field (because I tested the 'super secret' password "123456" using the numeric keypad and I got invalid password, and when I type it on the other numeric keys (bellow F1, F2, ...) it worked just fine. And again, in Windows version this problem does not occurs.

Comment
Add comment · 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

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

22 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

Related Questions

Can keyboard multimedia key events be captured? 0 Answers

How do I fix the input delay on Unity for Mac? 0 Answers

Xbox One/360 Controller trigger input drops out Mac OSX 0 Answers

Input.inputString is never set on Mac in a browser 1 Answer

Create an installer for Mac and Linux 1 Answer


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