• 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 ArkVoid · Aug 30, 2014 at 01:47 PM · lags

[Unity 4.6 beta] UI lags on android

Well I'm making a touch game with physics and bunch of other stuff.. Before the new UI went out I implements my self a temp UI for the game with GUIText and self Implemented buttons. The problem with the old UI was the scaling and placement so I moved on to the new UI system...

I switched the buttons and the GUIText to the new Buttons and Text from the UI system, after that when I run it on my Nexus 4 the game starts bit to lag, It extremely lags when my game updates the score UI Text (score updates like an arcade game iterative with IEnumarator- maybe this cause the lag?) anyway my game went fine even on my Galaxy Tab 3 before that and now you cant even control even if there is only a single UI button element on the screen, and like I said before it runs poorly on my Nexus 4...

Is there anyway to get rid of the lag? maybe it's because the UI system is in beta?

Sorry for bad English >_<

EDIT:

Well I did some experiments and I found out that the cause of the lag is the UI Text element... For some reason when I change its value (through textScore.text) the game lags like hell. I have no idea why this simple thing causes the lag... Here is some of the code that changes the text. private Text gText; private int score; private int scoreDes;

     void Start () 
     {
         score = 0;
         scoreDes = 0;
         gText = this.gameObject.GetComponent<Text> ();
     }
 
     // Calculating score and running AddScore Coroutine
     public void CalculateScoreAnRun(int numberOfBalls)
     {
         Debug.Log (numberOfBalls);
         int tempScore = 0;
 
         if (numberOfBalls < minBalls) 
         {
             tempScore = numberOfBalls * minBallsMultiplier;
         } 
         else
         {
             tempScore = numberOfBalls * normalMultiplier;
         }
 
         StartCoroutine (AddScore (tempScore));
     //    score += tempScore;
     //    gText.text = "Score: " + score.ToString();
 
     }
 
     // IEnumerator for "animating" arcade score
     private IEnumerator AddScore(int scoreAdd)
     {
         scoreDes += scoreAdd;
         while(score < scoreDes)
         {
             score++;
             gText.text = "Score: " + score.ToString();
             yield return null;
         }
     }

  • tried both with Co-routine and without (Marked in the code)

Comment
Add comment · Show 2
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 levela · Sep 20, 2014 at 07:26 PM 0
Share

Not really an answer, sorry about that, but currently developing on 4.6.0 beta 17 and the issue still seems to be persistent.

EDIT: Disabling "Best fit" in the text properties seems to have resolved the issue!

avatar image tanoshimi · Sep 20, 2014 at 07:27 PM 0
Share

@levela - if it's not really an answer, then please don't post it as one. Post a comment ins$$anonymous$$d.

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Project Upgrade caused lag on android 1 Answer

Just One of my scene is so laggy 0 Answers

Unity 5 Animation Window Super Lag 1 Answer

Is there anybody who can help me to get rid of lag? 1 Answer

Game lags in fixed intervals 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