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
5
Question by Tom 17 · May 12, 2011 at 08:37 AM · monodevelopdebugmonobehaviournunit

How to inspect non-MonoBehaviour classes in the debugger

My problem is that I can't inspect classes that don't derive from MonoBehaviour in MonoDevelop during debugging.

From what I could gather, from Google and this place, about Unity-debugging is that your only option is to use MonoDevelop. Now, if you want to use NUnit as a unit testing framework you can't use it to test classes that derive from MonoBehaviour. On the other hand MonoDevelop doesn't show any debug info for classes that don't derive from MonoBehaviour. The variable inspector simply states something like "reference not set to an instance of an object" (the actual message I get is in German). This is similar to what you get often times when a script references a missing Component and the like. But the instance does exist, I can even step into the code if I call a public method on the instance. What I tried, to no avail, is setting the "Active Configuration" of MonoDevelop to either Release or Debug (get debug info for MonoBehaviour classes for both settings but none otherwise). I tried setting the [System.Serializable] attribute for the class. I even tried out what happens if I stupidly set all accessor modifiers to public - defying everything we know about OOP. Nothing.

I know the workarounds: Put variables into MonoBehaviour classes that copy the properties you want to expect. Meh. Or make extensive use of Debug.Log. Meh. That's only giving a crutch to a man that could walk perfectly fine, if he knew how.

I will stick to SharpUnit for the testing, though I will have to tweak the error reporting a bit to fit for the Jenkins CI server I use. I would still rather use NUnit and basically it's not a good idea to have every class derive from MonoBehaviour just to make it debuggable.

Edit/Update: I dabbled a bit with the MonoDevelop you get via mono-project.com. It does debugging just fine, but lacks the Unity-Addins. Also the version that comes with Unity seems to be simplified, at least as far as the UI goes. I didn't figure out how to run the project with an other debugger than Unity-Debugger. Oh, maybe I should try to contact Lucas Meijer who is named as the author of the Unity-Debugger-Addin for MonoDevelop. Judging by the two up votes so far, I'm not the only one to have an interest in settling this matter :-)

Update2: Lucas suggested I should file a bug report. Did do. Let's see what happens.

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 yoyo · May 14, 2013 at 05:32 AM 0
Share

$$anonymous$$onoDevelop lets you inspect any type of variable, not just components. While it's true that NUnit, as integrated with $$anonymous$$onoDevelop, doesn't play nicely with Unity, it is possible to write your own NUnit integration for Unity -- basically you need to write at test runner that uses the core NUnit framework but implements its UI in Unity. You could also check the Unity Asset Store for unit testing frameworks.

avatar image whydoidoit · May 14, 2013 at 06:22 AM 0
Share

Lucas is right it must be a bug. It used to work fine until not so long ago. Also things like the List inspector broke a couple of updates ago.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by unimechanic · Jul 14, 2014 at 01:24 PM

This should work currently, otherwise please submit a bug report:

http://blogs.unity3d.com/2009/04/15/bug-reporting-and-you/

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Debugging unit tests with Monodevelop 0 Answers

How to get rid of the crash error in MonoDevelop 2 Answers

How to add watch in monodevelop? 0 Answers

Run unit tests (nUnit) in debug mode (MonoDevelop) 0 Answers

You are trying to create a MonoBehaviour using the 'new' keyword. 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