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 Railman85 · Apr 07, 2015 at 09:10 AM · debugbreakpoint

Is there a way to have a data breakpoint in unity3d?

Hello there!

Very often I face the same problem: Some script is changing some value (like transform) and it would be great to have a tool to print the stack of the code that make the modification.

In Visual Studio 2013 there is an option to add a "data breakpoint" which will stop the program whenever the given value changes. Unfortunately, its for C++ only.

Usually I write a wrapper to debuglog whenever the wrapped code is accessed. However, this solution consumes time

Comment
Add comment · Show 3
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 gjf · Apr 06, 2015 at 10:46 AM 0
Share

haven't tried it myself (data breakpoint), but do you have visual studio tools for unity (unityvs)?

avatar image Railman85 · Apr 06, 2015 at 11:52 AM 0
Share

gjf - yes, I have it installed and I can debug with Visual Studio. Unfortunately data break point is disabled (I read in documentation that its for c++ only)

I forgot to mention - there is 'alternative way' to achieve such breakpoint, but its not working always - you just need to remove the component and wait for next nullpointer exception :D

avatar image Nymisu · Apr 07, 2015 at 09:25 AM 1
Share

I personally use Debug.Break with a little bit of rigging. Works okay, but requires a bit of extra labor for some uses.

3 Replies

· Add your reply
  • Sort: 
avatar image
3

Answer by ShabihDesperado · Apr 07, 2015 at 10:06 AM

An option that you have is modify the var to a private field and become a property (with get and set). In this way you can use the breakpoint in the set function.

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 Railman85 · Apr 07, 2015 at 01:19 PM 0
Share

Thank you for your answer. Is it possible to do this with default components and their var (like transforms and colliders)?

avatar image ShabihDesperado · Apr 07, 2015 at 01:29 PM 0
Share

Yes but you have to make your own variable.

 private var myTransform;
 
 void Start(){
  myTransform = this.transform;
 }
 
 public Transform $$anonymous$$yTransform
 {
  get{ return this.myTransform;}
 }

It's not useful if any other script is trying to access getting the Transform component without calling the script function.

avatar image
2

Answer by stacker3d · Aug 10, 2015 at 06:32 AM

You can right-click a breakpoint and choose Breakpoint Properties to open a dialog where you can set a condition. Some breakpoints should help you to drill down the code that acidentally modifies the properties.

alt text

Related: https://unity3d.com/learn/tutorials/modules/beginner/scripting/monodevelops-debugger


break.png (19.3 kB)
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 ChrisHandzlik · Nov 15, 2021 at 04:56 PM

I've put together an asset that allows you to capture/debug all thouse changes to transforms.

Watch on Youtube alt text

That's available on Asset Store.

There's an open source approach https://github.com/handzlikchris/Unity.MissingUnityEvents

PS: ressurected old thread as it still comes up in google and I believe it can be helpful to others


transform-changes-debugger-youtube-thumb.jpg (193.1 kB)
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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Not able to use Visual Studio as debugger, but it works as editor 2 Answers

Monodevelop 4.0.1 breakpoints won't work. 0 Answers

VS 2013: Breakpoint only if an error happens 0 Answers

Debug breakpoints not breaking 0 Answers

Hitting Mono Breakpoint Crashes Unity 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