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 serenefox · Jul 13, 2014 at 04:36 PM · androidioslag

Android Touch Lag but not on iOS

EDIT I just wanted to bump this in hopes that someone possibly knows what is wrong. I think its a setting in the editor since the same exact script works totally fine on iOS, but after trying to mess with target framerate and vsync nothing has changed.

Hello,

I released a game on iOS (everything worked perfectly) and have now released it on Android but I am getting complaints that my player character has laggy input. I can't figure out why this is happening, especially since it worked totally fine on iOS. I found the script below and have been using it for both platforms for my characters controls:

 using UnityEngine;
 using System.Collections;
 
 public class MoveControls : MonoBehaviour {
 
     public GameObject player;
 
 
     // Update is called once per frame
     void Update () 
     {
         if(Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Stationary)
         {
             Vector2 touchPosition = Input.GetTouch(0).position;
             double halfScreen = Screen.width / 2.0;
 
             if(touchPosition.x < halfScreen)
             {
                 player.transform.Translate(Vector3.left * 6 * Time.deltaTime);
             }
             else if(touchPosition.x > halfScreen)
             {
                 player.transform.Translate(Vector3.right * 6 * Time.deltaTime);
             }
         }
     
     }
 }

I did port this from iOS to Android so I don't know if some type of settings may be a problem? And I don't have any errors either. If anyone can point me in the right direction I would be very grateful.

Thanks!

Comment
Add comment · Show 11
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 ado112 · Jul 13, 2014 at 04:46 PM 0
Share

Is your player colliding somewhere cuz transform.Translate is not for collisions(bad for physics) and that may cause lag,by the way what is name of your game,i would like to try it :)

avatar image serenefox · Jul 13, 2014 at 05:04 PM 0
Share

The name is "dodge drop pop" but I have another idea, my vsync is set to "every second Vblank" and I have a script that sets Application.targetframerate to 30 fps, could that be the problem?

And my player isn't colliding with anything, he is floating, there is no floor/grounded type of thing.

avatar image ado112 · Jul 13, 2014 at 05:16 PM 0
Share

hmmmmm,have you tried transform.Translate(0,0,0); this:

 using UnityEngine;
 using System.Collections;
  
 public class $$anonymous$$oveControls : $$anonymous$$onoBehaviour {
  
     public GameObject player;
  
  
     // Update is called once per frame
     void Update () 
     {
         if(Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Stationary)
         {
             Vector2 touchPosition = Input.GetTouch(0).position;
             double halfScreen = Screen.width / 2.0;
  
             if(touchPosition.x < halfScreen)
             {
                 player.transform.Translate(-6*Time.deltaTime,0,0);
             }
             else if(touchPosition.x > halfScreen)
             {
                 player.transform.Translate(6*Time.deltaTime,0,0);
             }
         }
  
     }
 }
avatar image serenefox · Jul 13, 2014 at 05:23 PM 0
Share

I have not but isn't that the same thing I'm doing, but just a different way of writing it?

avatar image ado112 · Jul 16, 2014 at 09:19 PM 1
Share

Have you changed anything since last update? Everything works perfectly now.

Show more comments

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

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

How do I access CoreMotion and the Android equivalent? 0 Answers

Display Activity indicator center 0 Answers

big terrain performance && mobile 1 Answer

C++ windows DLL and Android? 1 Answer

I'm looking for help with enemy AI scripting and animations. 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