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 dknesek · Dec 26, 2012 at 09:42 PM · timesimulation

How does Unity handle time scheduling?

I want to use Unity to build agent-based simulations that will be used in an educational setting.

1) How does Unity do time scheduling? Is there a discrete-event time scheduler under the covers?

2) If two objects "tie" with respect to scheduled time, how does Unity decide which object gets handled first?

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 whydoidoit · Dec 26, 2012 at 09:46 PM 0
Share

It's better to ask 4 questions than 1 (or perhaps in this case 2 questions). You will often find that one person is unable to answer all parts, so will often answer none. Also UA is a $$anonymous$$nowledge Base and so is really designed for single question/single solution postings.

avatar image dknesek · Dec 26, 2012 at 09:51 PM 0
Share

Thanks. I'll split this.

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by whydoidoit · Dec 26, 2012 at 09:56 PM

Q1/2: Unity provides a random number between 0..1 (don't know the algorithm) or an integer between two limits. The functions are aimed at randomly selecting something from an array or list, or providing a numerical value to push into another function. Certainly you could apply a curve to the 0..1 and multiply it out to get a distribution you wanted. Unity provides the ability to hand draw curves or of course you could use a mathematical function.

You can also use .NET's random number generator.

Q3. With the main game loop Unity will run it as fast as possible (with a potential for frame syncing to limit this to a certain FPS). On every game loop all of the objects are updated. You can tell certain scripts to run before or after others and there are multiple hook in points you can use to execute code in different sections throughout the frame.

Unity provides a "time since last frame" value that you can use to provide framerate independent movement.

Physics runs in a fixed time step, so this runs one time after another to catch up with real time. It isn't real time, it's just catching up with it, but within that time step you can guarantee that the physics functions have incremented by the fixed step as a simulation.

Q4: As it isn't event scheduled but game loop scheduled this doesn't really happen (apart from my comments around being able to specify that one script executes before another.

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

10 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

Related Questions

Speed up and iteratively simulate a game in unity? 1 Answer

Accelerate/Decelerate Custom Game Clock 2 Answers

Transform localPosition on time 2 Answers

(Android) Timer change script help 0 Answers

Changing lighting/skybox based on Computer Time? 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