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
1
Question by JustJunuh · May 11, 2017 at 06:33 AM · physicsupdateplatformerfixedupdatetime.deltatime

Physics after build feel different vs In-Editor (Time.deltaTime)

Hey all so I ran into this issue here.

Here's a quick video to summarize it

Let me know if you need any more details.

Thanks for your help in advance!

Comment
Add comment · Show 5
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 JustJunuh · May 11, 2017 at 06:00 PM 0
Share

@AlwaysSunny Hey could you help me with this? ^

~The guy you helped make the third person camera a while ago :)

avatar image AlwaysSunny JustJunuh · May 11, 2017 at 06:47 PM 0
Share

I'm afraid I've had my own troubles getting the standalone builds to behave 1:1 to the Editor. I'm still on 4.x so it's a whole different problem, I'm sure.

It's a good idea to paste in your relevant code (was collapsed in video) - but given your normal experience in the Editor it's likely fine.

$$anonymous$$y first thought is to tinker with vsync and other project settings. I recall that certain features will (or used to) behave differently in the editor vs standalone, but I don't recall which / what / how.

Rule out your logic as the culprit first (paste & share if you're not positive), but either way that's an area worth studying: The differences between testing in the editor vs standalone builds.

I'm sorry I don't remember specifics or have a resource to share. $$anonymous$$y prior cursory investigations revealed that there are indeed discrepancies that may cause issues related to time. Whether such a discrepancy is the issue remains to be seen. Best,

avatar image JustJunuh JustJunuh · May 12, 2017 at 08:40 AM 0
Share

@AlwaysSunny First off, thanks for responding! I really appreciate it. O$$anonymous$$, so I did some digging, and I set up the profiler to the standalone build. I managed to get something interesting.

http://imgur.com/a/oS3BR

That's a screenshot from what the profiler showed me.

Seems the big culprit is GFX.WaitForPresent

Any clue what that could mean?

avatar image AlwaysSunny JustJunuh · May 12, 2017 at 02:48 PM 0
Share

As I understand it, WaitForPresent is like idling. If the CPU is working, but the GPU has finished, you get WaitForPresent. There's an Idle CPU / Busy GPU equivalent too that'll show up in the CPU graph. Basically it's what you get when the two devices have different workloads per frame.

This thread gets into it pretty deep if you want to explore. They discuss some valuable ideas, though I'd caution you that only half of them seem to know what they're talking about.

I think at best it's indirectly related to your problem, though. As someone pointed out, trying to "fix" WaitForPresent is like trying to alter a thermometer to control the heat.

Given this question hasn't got any traction, I'd consider rewriting it with a different title. The video still applies, of course, but you should try to briefly summarize it in text too - and share code. Even perfect questions will get ignored, but it's worth a shot.

Title it something like Game Performance Different In Standalone (Video Example). If you still don't get any help, maybe drop by the Unity IRC channel - I'm assu$$anonymous$$g there still is one - because the big dogs don't seem to cruise UA as often as they used to.

avatar image Matthewj866 · May 12, 2017 at 03:57 PM 0
Share

If this is using physics, you shouldn't really be using Update() as the physics don't update themselves every frame.

Have you tried porting the physics to FixedUpdate() with time.fixedDeltaTime ins$$anonymous$$d?

1 Reply

· Add your reply
  • Sort: 
avatar image
3
Best Answer

Answer by JustJunuh · May 12, 2017 at 06:35 PM

@Matthewj866 @AlwaysSunny

I'd like to thank both of you so much for all your help! I finally fixed it!

For anyone else suffering from these issues,

Use FixedUpdate() and Time.fixedDeltaTime for physics and movement!

These changed EVERYTHING!

I got 144fps both in the editor and on a standalone build.
The actual gameplay is now 1:1.

Originally, I didn't want to use FixedUpdate() that much because it looked like all the movement was jittery. Although I think Time.fixedDeltaTime was the trick to fix that.

I did tweak some project settings but to no avail. It was FixedUpdate() and Time.fixedDeltaTime that fixed everything!

Thanks for your help!

Comment
Add comment · Show 2 · 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
avatar image AlwaysSunny · May 12, 2017 at 06:59 PM 0
Share

Aha! And that's why it's always a good idea to show your code. ;) You have stumbled upon the correct paradigm for managing physics-related activities: Get your input in Update and drive anything physics-related in FixedUpdate. Still not sure why it impacted framerate in the way it did, but I'm glad you got it sorted out!

avatar image JustJunuh AlwaysSunny · May 12, 2017 at 07:00 PM 0
Share

$$anonymous$$e too! Yeah the fps issues didn't make any sense though :/

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

141 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

Related Questions

Physics using Time.deltaTime? 1 Answer

Addforce in fixedupate 0 Answers

Does FIxedUpdate get called every 0.02 seconds? 2 Answers

Does GraphicRaycaster.Raycast produce more reliable results in Update or FixedUpdate? 0 Answers

Do something after the next physics step (not the frame) 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