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
1
Question by oliver-jones · Apr 04, 2011 at 06:50 PM · timeframenumberdecrease

Decrease a value over time?

Hello,

I basically have a figure that decrease from 100, to 0, and then increases back up to 100.

All I'm basically doing is this: figure --; in an update function, which of courses decreases the value every frame.

Is there a way to do this in a controlled manor? (as frame rate is dependent on computer speed)

So .. time?

--UPDATE EDIT--

Okay,

So ive put this in a fixed update:

figure -= (Time.deltaTime * emptySpeed);

And no matter what I turn the emptySpeed number into (except 0) - the figure decreases at the same speed, is there a way to possible slow it down??

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

2 Replies

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

Answer by Eric5h5 · Apr 04, 2011 at 06:59 PM

Use InvokeRepeating.

Comment
Add comment · Show 3 · 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 oliver-jones · Apr 04, 2011 at 07:11 PM 0
Share

Please read my update

avatar image oliver-jones · Apr 04, 2011 at 07:29 PM 0
Share

I tried this - and it still seems like its using frame rates? In the editor the number decreases slowly, and in the build - its reallllyyy fast!

avatar image Eric5h5 · Apr 04, 2011 at 08:55 PM 0
Share

Then you must have done it wrong. Take a look at the example code in the docs (note that there is no Update at all).

avatar image
0

Answer by DaveA · Apr 04, 2011 at 06:55 PM

Please read up on the Time component as well as FixedUpdate function

Comment
Add comment · Show 4 · 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 Eric5h5 · Apr 04, 2011 at 07:02 PM 0
Share

FixedUpdate is for physics, it's not for ti$$anonymous$$g (among other things, there's no guarantee that it will run the same number of times every second, nor when it will run).

avatar image oliver-jones · Apr 04, 2011 at 07:11 PM 0
Share

Please read my update

avatar image DaveA · Apr 04, 2011 at 07:19 PM 0
Share

I stand corrected.

avatar image DaveA · Apr 04, 2011 at 07:21 PM 0
Share

$$anonymous$$ake sure you are using floating point values for emptySpeed?

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

No one has followed this question yet.

Related Questions

Increase/Decrease Over Time, Not Frames 1 Answer

how to decrease repeating time in invokerepeating? 2 Answers

How Increase And Decrease And Reset Spawn Rate Over 0 Answers

Big frametime on iOS + intermittent cpu-waits-gpu 0 Answers

Decreasing object size until a certain size over time? 2 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