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 trigon · Mar 31, 2015 at 03:11 PM · c#androidunity 5

Android build misbehaving.

Sorry about the vague title, but I've got no idea how to explain the issue briefly. I'm having some really weird issues in Unity 5. The program is essentially a comic book app. When the user presses the screen, the next thing happens, whether that is a new panel transitioning in or part of the panel animating. It's super simple stuff - or should be at least. Everything works flawlessly in the editor, and in the standalone application, and in the web player. When I build it for Android there are some strange issues - the major one being that the first panel doesn't slide in until you touch the screen - at which point the panel slides in and the first panel animation happens. This isn't what should happen - when it's running on anything else the first panel comes in automatically and the first animation doesn't happen until you touch the screen (or press space).

Thanks in advance!

Here is the code:

 void Update ()
     {
         GetInput (); 
 
         foreach (GameObject panel in panels)
         {
             Panel pScript = panel.GetComponent<Panel> (); // Get the panel script, which allows me to use public variables and functions
 
             if (pScript.panelNumber == activePanel && panel.activeSelf) // if the panel is active 
             {
 
                 if (!pScript.transitioning) // if the panel is not mid-transition
                 {
                     panel.SetActive(true); // activate the panel
                     pScript.TransitionIn(); // transition in
                 }
 
                 if (sequenceNo != -1 && sequenceNo < pScript.numSequences) // if the sequence number is not -1 (panel transition) and is in range
                     pScript.ActivateSequence(sequenceNo); // activate the correct animation
 
                 if (sequenceNo >= pScript.numSequences) // if the sequence number is greater than the amount of animations in this panel
                 {
                     sequenceNo = -1; // reset the sequence number
                     ++activePanel; // move to the next panel
                     pScript.ResetLerp (); // reset lerp variables (otherwise the animation doesn't play)
                     pScript.TransitionOut (); // move the panel out of view
                 }
             } 
             if ((pScript.panelNumber == activePanel-1) && !pScript.transitioning)
                 panel.SetActive(false); // if the panel is the last used panel and it is finished transitioning, deactivate it
 
         }
     
     }
 
     void GetInput ()
     {
         if (Input.GetKey (KeyCode.Escape)) // 'Back' key on Android
             Application.Quit (); // Quit the application
 
         if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer || Application.platform == RuntimePlatform.WP8Player)
         { // if the platform requires touch input
             if (Input.GetTouch (0).phase == TouchPhase.Began) // as soon as a touch is registered
                 ++sequenceNo; // increment the sequence
 
         } else {
 
             if (Input.GetKeyDown (KeyCode.Space)) // if the platform doesn't have touch input
                 ++sequenceNo; // increment the sequence
         }
     }

[edit: added comments to better explain what's going on]

[Second edit] Escape now works, no idea why. All I did was load and rebuild the project today! However, the other issues are still there, so I've changed the question.

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 FlutterCZ · Mar 31, 2015 at 03:26 PM

Not sure, but try to put

 if (Input.GetKey (KeyCode.Escape))
              Application.Quit ();

into the Update function.

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 trigon · Mar 31, 2015 at 03:34 PM 0
Share

Unfortunately I've tried that, and it doesn't work!

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

20 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

Related Questions

Unity ads are working in editor but not on android device 2 Answers

How to take input from the fingerprint sensor,which is now becoming a part of more or less every android device???? 1 Answer

How to destroy a particular clone on touch/mouse? 1 Answer

how to make the sprite and the background color in a tile disappear? 0 Answers

Unity2D - how to move object to the touched position 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