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 wojtask12 · Oct 30, 2015 at 09:06 PM · iosperformancelagiphone5

Performance issue on iPhone 5

Hi guys, I'm getting some weird performance issues on iPhone 5 - the game lags when the user taps the screen to change direction. It doesn't happen on iPhone 6/iPod 6g/iPhone 4. Tried to experiment with disabling sounds, changing fixed timestep, but nothing helps. Here's my Update code which seems to be a problem:

     void Update ()
     {
 
         if (Input.GetButtonDown ("Fire1")) {
          if(started)
             {
                 gameController.IncScore ();
                 if (nextLos == 0) 
                 {
                     index += ballDir;
                     if (index == TrackPath.currentPath.angles.Length)
                         index = 0;
                     else if (index == -1)
                         index = TrackPath.currentPath.angles.Length - 1;
                     ballDir *= -1;
                     dir = Quaternion.Euler (0, 0, 180) * dir;
                 } 
                 else 
                 {
 
                     index += ballDir;
                     if (index == TrackPath.currentPath.angles.Length)
                         index = 0;
                     if (index == -1)
                         index = TrackPath.currentPath.angles.Length - 1;
 
                        dir = Quaternion.Euler(0, 0, TrackPath.currentPath.angles[index] * ballDir) * dir;
                     pathNo += ballDir;
                     if (pathNo == -1)
                         pathNo = TrackPath.currentPath.angles.Length - 1;
                     else if (pathNo == TrackPath.currentPath.angles.Length)
                         pathNo = 0;
                 }
             
             }
             else {
                 started=true;
                 gameController.tapToStart.GetComponent<PopUpEffect> ().StartCoroutine ("SimplePopDown");
                 if (nextLos == 0) {
                     ballDir = -1;
                     index = 1;
                     dir = TrackPath.currentPath.startDir2;
                 } else {
                     ballDir = 1;
                     dir = TrackPath.currentPath.startDir1;
                 }            
             }
             if (pathNo == 2)
                 tpJumpsCount++;
             else {
                 keyCountdown--;
                 if (keyCountdown == 0) {
                     gameController.SpawnKey ();
                     keyCountdown = keyDelay;
                 }
             }
             nextLos = next2Los;
             next2Los = Random.Range (0, 4);
             if (v < 7f)
                 v += .2f;
             player.velocity = dir*v;
         }
     }

void IncScore() is just score++; ScoreView.text=score+""; What's interesting, the longer the game is running, the smoother it gets - after couple minutes running it's perfect. It also seems to run a little better on iPhone 5 with ios 9 - lags on tap are not that often - but still happens. On ihone 5 with ios 8 - the lag happens almost each time you hit a screen.

Can you see anything suspicious? Or you had similar problem with iPhone 5?

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 hexagonius · Oct 31, 2015 at 12:37 PM 0
Share

Have you ran the profiler and looked for spikes in that frame? You should try that, first in Editor, then from device. It should tell you what's causing this.

avatar image wojtask12 · Oct 31, 2015 at 09:06 PM 0
Share

I don't have psychical access to that iPhone 5. Profiler in Editor doesn't show any spikes on "tap". But it also was happening on collecting an item on path, so i searched for a common actions for these 2 moments - it turns out that updating UI Text component with current score/item count cause this. Now i'm about to check why is that happening - my idea for now are corrupted font file, don't know if that's possible. If that's not it, i'm gonna install newest unity - now i'm using 5.1.3. But my previous game was also built with 5.1.3 and there was no problem with updating text..

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by wojtask12 · Nov 03, 2015 at 08:52 PM

That was font issue - changing the font file to .otf version found in web helped.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

iOS builds run poorly until device restarted after update 0 Answers

Game Runs Horribly Slow On iPad? 3 Answers

device.present lag iOS iPad1 0 Answers

[iOS] Frame rate drops when ASSISTIVE TOUCH is on 0 Answers

Coin Magnet Performance Issue Mobile 3 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