Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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
3
Question by s_guy · Oct 31, 2013 at 07:30 PM · getcomponentmonodevelopcomponentdebuggerwatch

Any way to see if a gameObject has a component from MonoDevelop debugger?

Obviously I can use GetComponent() in code, but that doesn't seem to work from the watch window as I would expect it to in Visual Studio. Also, browsing the gameObject in the debugger, I can't find a reference to any of my custom component types. Though, the common base component references are easy to find (renderer, rigidbody, collider, etc.). I guess I'm expecting an array of component references somewhere.

So, short of adding the GetComponent in script and recompiling, is there any way to effectively poke around in a gameObject's custom components from the debugger? I have captured a difficult-to-reproduce test case so it'd be nice to not have to try to recreate it. Also it'd be interesting to find out how this works internally.

I can only find this dead and unanswered similar question

http://answers.unity3d.com/questions/339428/using-functions-in-monodevelop-watch-window.html

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 s_guy · Oct 31, 2013 at 07:41 PM 0
Share

Hmm, on trying to call functions from the Watch window in the debugger, I noticed that it claims that the request isn't supported by the protocol implemented by the debugee. So, apparently its a Unity limitation and not a $$anonymous$$onoDevelop limitation (which Visual Studio may also not be able to get around).

Still, any ideas for other approaches would be helpful.

avatar image Jamora · Oct 31, 2013 at 09:01 PM 0
Share

Unfortunately I only have general debugging tips to offer:

Depending on the nature of the bug, you might be able to use Debug.Break() to pause execution of the game. That is the equivalent of pressing the pause button in the Editor only if something goes wrong. This is especially useful if you have a branching logic where a branch is only entered when something goes wrong. Doing it like this allows you to see the general state of the game from the Editor.

 if(myNotNullClass == null)
     Debug.Break();

To further help with the debugging process, you can view private variables of your custom Components by clicking on the three lines next to the lock icon just above the inspector. Like in this answer.

avatar image s_guy · Nov 01, 2013 at 07:41 PM 0
Share

Good tip, but only usable when you can set up to diagnose a known, repeatable issue.

I use a regular breakpoint or a conditional breakpoint in the debugger ins$$anonymous$$d. That way, I can explore more than what the debug view in the editor's inspector will show and I can keep my scripts clean.

0 Replies

· Add your reply
  • Sort: 

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

16 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

Related Questions

Monodevelop Debugger evaluates temp variable as "null" in for loop when clearly not null 1 Answer

Monodevelop attach Android player to process 1 Answer

GetComponent of ALL clones? 2 Answers

Access component of parent with multiple children 2 Answers

Stepping in MonoDevelop Debugger takes a long time when using buttons 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