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 post has been wikified, any user with enough reputation can edit it.
avatar image
1
Question by TheMaster42 · May 07, 2013 at 09:35 PM · monodevelopfor-loopforeachdebuggerwatch

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

Whenever I'm using Monodevelop-Unity to step through code in a for..in loop (aka "foreach"), if I try to add the temporary variable to the watchlist, it always evaluates to null, even when the value is clearly not null (and the code executes to represent this).

For example:

     for (var firingShip : GameObject in firingFleetArray) {
         if (firingShip) {
             firingShip.GetComponent(Ship).Fire();
         }
     }

If I add firingShip to the Watch list, it always displays as null. But at the same time if I add firingFleetArray to the Watch list it will display its members correctly (none of which are null). Additionally, I can Step Into the code and get to the Fire() function, even though the code should skip over it if firingShip were actually null.

I've googled everywhere for something like this but can't find anything. Is something messed-up about my installation, or am I missing some obvious setting?

Comment
Add comment · Show 4
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 whydoidoit · May 07, 2013 at 09:37 PM 0
Share

Only if there's something messed up about $$anonymous$$e too :/ $$anonymous$$onoDevelop debugging is very flaky around variable evaluation I find. Hoping someone else knows more than I do about it.

avatar image whydoidoit · May 07, 2013 at 09:38 PM 0
Share

And while we're at it - how can we be 2 versions behind the current on $$anonymous$$onoDevelop - 3.x added amazingly improved refactoring and usage searching.

avatar image TheMaster42 · May 08, 2013 at 07:45 PM 0
Share

Wow, so basically it works this way for everyone?

avatar image whydoidoit · May 09, 2013 at 07:04 AM 0
Share

Apparently so. I think it probably depends on how you script, but there are big holes in it for sure.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by ProgrammerJoe · Sep 08, 2013 at 10:43 PM

This can happen if the variable you are watching is an object derived from UnityObject. If the "name" field isn't set it will be null, and UnitObject's ToString method will unhelpfully return that as the value of the variable.

This also seems to cause MonoDevelop to get confused about the fact that the variable has a real value in some cases. I fixed it in my case by not having a couple of classes derive from UnityObject.

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

14 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

Related Questions

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

Monodevelop attach Android player to process 1 Answer

How to access static members in the watch/immediate window when debugging with MonoDevelop 0 Answers

Stepping in MonoDevelop Debugger takes a long time when using buttons 1 Answer

Copy values between two classes in two lists. 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