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 /
  • Help Room /
avatar image
0
Question by OttoClausen · Aug 25, 2016 at 12:34 PM · androidtimephysics2dtime.deltatimehiccup

Android: Hiccups in simple scene - related to time

I am trying to finish my first game made in Unity, everything is ready but I have a very annoying problem. When I play the game on an Android device I face an annoyance that multiple other people have been posting about without really finding any solution. I have tried everything when it comes to optimizing but without any luck eliminating the problem.

I thought this was really strange so I started a new project with only 1 scene containing a camera and a sprite with a simple script attached.

 using UnityEngine;
 using System.Collections;
 
 public class Character : MonoBehaviour {
 
     // Update is called once per frame
     void Update () 
     {
         transform.Translate (Vector2.right * 10 * Time.deltaTime);
     }
 }
 

And what do you know? This very simple scene also caused the "hiccups" or studdering on my Android device. I was pretty confused by this realization, how can such a simple scene cause hiccups? I still don't know the answer but today I think I might have identified what is causing the problem. What I did was I changed the line of code that moves the character from transform.Translate (Vector2.right * 10 * Time.deltaTime);

to

transform.Translate (Vector2.right * 0.15f);

For the first time the project was running without any studdering or hiccups on my Android device. I understand that this is not a good code but it has made me realise that the problem must be with Time.deltaTime.

In my actual game the character has a rigidBody2D attached to it and is moved by setting rigidBody2D.velocity. So I tried to replicate this in my "testing project". I added the rigidBody2D component to the sprite. I set the gravityscale to 0 and turned on Interpolation. To move the sprite now with the rigidBody2D component I attached the script was changed to this:

 using UnityEngine;
 using System.Collections;
 
 public class Character : MonoBehaviour {
 
     private Rigidbody2D playerBody;
 
     // Use this for initialization
     void Start()
     {
         playerBody = GetComponent<Rigidbody2D> ();
         playerBody.velocity = new Vector2 (10, 0);
     }
 }
 

And once again this simple scene is causing studdering in my Android device every few seconds and it is horrible for the eye. Could this be related to the fixed timestep or perhaps something needs to be changed in the Physics2D settings? (I am using the default settings). I am so fed up with not being able to finish my game due to this annoying studdering and I have not been able to find any solution online. I desperately need some help or perhaps some ideas what I can try to make the studdering go away.

Thank you in advance - Otto

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

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.

Follow this Question

Answers Answers and Comments

104 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 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 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 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 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

Returning abnormal values with Time.deltaTime and Time.unscaledDeltaTime. 0 Answers

[Android] When App closed get time when player was gone? 1 Answer

C# How to have a scripted if statement last x amount of seconds 1 Answer

Light intensity Lerp not functioning properly 1 Answer

Time.deltaTime and difference of Time.time not matching 0 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