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 /
avatar image
0
Question by thunderbuns · Feb 15, 2018 at 09:08 PM · console.log

Logging to the console evey millisecond

I am trying to log a variable to the console every millisecond so that I can see how often said variable is changing. But I haven't been able to figure out how to do this, any provided assistance would be very helpful.

Comment
Add comment · Show 6
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 ElijahShadbolt · Feb 15, 2018 at 09:35 PM 0
Share

Even if your game is running at 60fps, that's still one frame every 16.6 milliseconds. I don't think it's practical to do a task every single millisecond.

avatar image thunderbuns · Feb 16, 2018 at 12:03 AM 0
Share

@Cresspresso I am using the Wii fit board and I want to figure out how often the data that I am receiving is being refreshed.

avatar image calpolican · Feb 16, 2018 at 02:37 AM 0
Share

$$anonymous$$eep in $$anonymous$$d that the time will change depending on the amount of computation. For this kind of things I think is best to use Unity's built in tool, the profiler.

avatar image thunderbuns · Feb 16, 2018 at 04:30 AM 0
Share

@calpolican what is the profiler?

avatar image ElijahShadbolt thunderbuns · Feb 16, 2018 at 07:36 PM 0
Share

Unity $$anonymous$$anual: Profiler overview

avatar image thunderbuns ElijahShadbolt · Feb 16, 2018 at 07:39 PM 0
Share

Interesting... Thanks.

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by ElijahShadbolt · Feb 15, 2018 at 09:37 PM

If your variable is a field, you could wrap it with a C# property so that when it is set, it logs a message.

 private float myVar;
 public float MyVar {
     get { return myVar; }
     set {
         Debug.Log(value);
         myVar = value;
     }
 }
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
avatar image
0

Answer by Xarbrough · Feb 16, 2018 at 04:09 AM

How are you receiving data from the Wii fit board? Does it have a threaded callback? Then log your variable in there. If you are polling in Update, you can only log once every update call, roughly 16ms. You can also create a UI label to display the value every frame to see it changing. Alternatively, in Visual Studio there are conditional breakpoints, which you can set to trigger only if something specific happens. You can also attach the debugger and monitor variables via the watch window, but I'm not sure how often this gets refreshed, but probably only when you manually refresh it.

Comment
Add comment · Show 1 · 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 thunderbuns · Feb 16, 2018 at 04:27 AM 0
Share

@Xarbrough thanks for your suggestions I need to do more research into how I get the data from the Wii fit board.

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

77 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

Related Questions

Debug.Log Problem: How To Log Variable Values As Strings? 1 Answer

Custom Console Window : Differentiate compiler error when clearing console 0 Answers

How do you open the Player Log? 2 Answers

Errors on console on freshinstall of unity,errors on console on fresh install of unity just today. 0 Answers

How to *not* batch console output? 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