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 /
This question was closed Apr 12, 2012 at 08:05 AM by Kleptomaniac for the following reason:

Terribly explained ... Trying a new question.

avatar image
0
Question by Kleptomaniac · Apr 12, 2012 at 12:42 AM · booleanrandom.rangevaluetime.deltatimelog

Log a quickly changing value without boolean flags

Hey there,

This may seem like a simple question, but this is the only way I've found to do it. Is there a way to capture a quickly changing value (such as a Random.Range or a Time.deltaTime) at a specific point in time without using boolean flags in an arrangement like this?

 if (boolFlag) {
     varForLogging = Random.Range(0, 800);
     boolFlag = false;
 }

It seems as if there should be an easier way to log values than this, however I haven't been able to find any other solutions for this. Don't get me wrong, this works fine, I'd just like to know if this is in fact the best for solution for capturing values.

Thanks for your time,

Klep

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 syclamoth · Apr 12, 2012 at 12:48 AM 1
Share

Not quite sure what the deal is here. Why don't you call a function that logs the value directly? Could you explain a little further what is going on here? What's wrong with using 'Debug.Log'? Also, Random.value doesn't change until you call it (because every call to 'Random' changes the seed).

avatar image Kleptomaniac · Apr 12, 2012 at 06:15 AM 0
Share

Sorry if I wasn't very clear. I'm not talking about debugging here, I'm talking about ins$$anonymous$$d capturing the value of a quickly changing class such as Time.deltaTime at an exact frame and not having that variable continue to change as Time.deltaTime changes. For example, in one frame Time.deltaTime might be 0.56 and then in the next frame might change to 0.76. I want to capture that 0.56 in a variable and not have it change to 0.76 as Time.deltaTime continues to change. The only way I've found to do this is to have a boolean automatically negate itself, however I know that this mustn't be the best way of doing things.

Here is a working example of what I mean here:

 if (clockStop == 1) {
     if(!hasStopped) {
         stopTime[ts.$$anonymous$$inute] = gt.currentTime;
         stopTime[ts.Hour] = gt.currentTime;
         hasStopped = true;
     }
 }

currentTime is a time variable which is incremented in another script by Time.deltaTime * rate. I want to find the exact "currentTime" at the moment an int becomes 1. However, if I were to do this without the boolean flags, stopTime[ts.$$anonymous$$inute] and stopTime[ts.Hour] would continue to increment as currentTime increments. I'm sure there must be a more elegant solution than this, because it seems very hacky to me.

Just to clarify, I only found this solution originally here from @DaveA.

So sorry if this has made things a hell of a lot more confusing ...

Thanks for your help anyway @syclamoth :)

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

PowerUp problem(s) 1 Answer

How do I change the logged text based on a momentary collision? 1 Answer

How can i keep making the SendMessage repeat as long as the boolean is true 1 Answer

How would I show the value of a random value? 1 Answer

Randomly setting a boolean to true? 3 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