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 misun1191 · Aug 22, 2020 at 01:25 PM · fpswebgltime.time

webgl, Unity time and system time mismatch with low FPS

Hi, I made a simple spatial memory experiment (player walk around the scene and remember the location of props. I analysed their memory error for my scientific research ) using Unity 2019.1. I built WebGL, posted on my webserver and recruited players (=experiment participants) from Mechanical Turks. The problem is that at least 15% of players experienced a laggy behaviour (low frame rate) and there is a huge mismatch between the Unity internal time and System time.

For instance, Unity.Time showed that 300 sec has passed between the events, but System.DateTime.Now indicated that 600~2000 sec has passed between the events. This problem occurred in only some players and I have no idea why or how this happened. I noticed that when this discrepancy happened, frame rate was low as 10FPS. Most other players had a decent FPS (50 or higher) and Unity Time and System Time match. I don't know what kind of system, browsers were used by players who experienced the laggy behaviour. I only have one anecdote from anonymous player that initial loading of the WebGL was fine, but the movement was very slow.

  1. Does anyone experience a similar problem?

  2. Why is there a discrepancy between the Unity Time and System Time? (there is no Time.scale/pause used in my game, so I think the two should be almost perfectly in line)

  3. Is there any recommended practice/procedure that only allows users with reasonable computing facility to play the game?



any comments, help would be greatly appreciated! Thanks

Misun


Additional information about how I recorded the player's position in while loop (like below).

 IEnumerator familiarPhase(){
    string savefn=subId+"_familiarisation_"+System.DateTime.Now.ToString("yyyyMMdd_HHmm")+".txt";
    string savetext="";
 
    float inittime=Time.time; float timelimit=300;
    while (Time.time-inittime<timelimit){
       savetext=savetext+Time.time.ToString("F2")+"/t"+character.transform.position+"/n";
       yield return null;
    }
    StartCoroutine(save2file(savefn,savetext)); //custom made function that save the string into file on the web server (using Unity SendWebrequest)  }
 

I included System.Time information in the file name to know when the player started this part of the game. I then saved Unity internal time (Time.time). In my experiment(=game), multiple small tasks are executed in order.

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 misun1191 · Aug 22, 2020 at 01:30 PM 0
Share

Probably the most relevant looking thread is this one by @homer_3 , who experienced low FPS and mismatch in ti$$anonymous$$g when playing audio. I don't think the solution suggested to this other thread is relevant to my problem..

https://answers.unity.com/questions/1208212/time-not-accurate.html?sort=votes

avatar image N-8-D-e-v · Aug 27, 2020 at 01:57 PM 0
Share

System.dateTime.now is always the most accurate if I remember correctly, and Unity.time doesn't exist as far as I know, unless you mean Time.time. Of course, your issue could just be with webgl, have you tested on a standalone build?

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by misun1191 · Dec 16, 2020 at 06:32 AM

I now realised the reason for the mismatch between Unity Time and SystemTime in WebGL. If players defocus the WebGL browser (e.g. click other browser tab), then Unity clock is paused while System Time is still updating. So, the timing issue was independent of frame rate.

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

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

FPS = 440 according to Stats, but Update prints only 50 frames? 1 Answer

GameObject Instanitation causing lag on webgl for mac os with chrome 0 Answers

WebGL low fps 0 Answers

How to use CursorLockMode in webGL 0 Answers

WebGl Mouse Look Problem 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