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
0
Question by TenTonApe · Mar 23, 2013 at 03:40 PM · c#listmonodevelopdebugger

List Bug when using debugger

So I have a list of enemies that I instantiate via a loop. This successfully spawns an enemy, but only ever one. When I make the list I get ENData (null) when I set it to the levels enemy list (taken from another script) it becomes this:

 EBData    Count=1
           Unknown type 'System.Collections.Generic.CollectionDebuggerView'1, mscorlib.dll'

Now when it goes into the loop I can view the variables inside by hovering my mouse over them, and the enemy is spawned correctly. If I go into the script the list is being called from and check it there I receive the same error.

Comment
Add comment · Show 9
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 whebert · Mar 23, 2013 at 03:54 PM 0
Share

Post some code, easier to help that way.

avatar image TenTonApe · Mar 24, 2013 at 01:30 AM 0
Share

Alright here is some code (Sorry for the delay (9 hour shift)) This is the EnemyData Struct public struct EnemyData{ string mName; int mX; int mY;

     public EnemyData(string name, int x, int y){
         mName = name;
         mX = x;
         mY = y;
     }
     
     public string Name{
         get{return mName;}    
     }
     
     public int X{
         get{return mX;}    
     }
     
     public int Y{
         get{return mY;}
     }
 }

And inside Level I have: (Remember Enemies here causes the error as well)

 protected List<EnemyData> Enemies = new List<EnemyData>();
     
 public List<EnemyData> GetEnemyData(){
     return Enemies;
 }

And then in AI$$anonymous$$anager I have:

 List<EnemyData> ENData = new List<EnemyData>();
 ENData = GetComponent<Level$$anonymous$$anager>().CurrentLevel.GetEnemyData();

Does that help?

avatar image TenTonApe · Mar 24, 2013 at 02:07 PM 0
Share

I had this bug before, I fixed it by making a new class file and copy the code in, but I'd like a better fix.

avatar image whebert · Mar 25, 2013 at 06:33 PM 1
Share

O$$anonymous$$, I ran a test and got the same error in the debugger as you. Then I saw this at StackOverflow. So, this would seem to be a bug in $$anonymous$$ono, but should only affect you when using the debugger.

In my test, I added several items to the list, then printed them out in Debug.Log and they were all there. So this bug should not affect your running game.

avatar image psantoki · May 12, 2014 at 08:13 PM 1
Share
  • whebert for suggesting printing Lists, this is a genuinely good tactic given the weepy state of the editor.

  • for 'only happens when debugging'. Bert, debugging is the most important part of writing code

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Artless · Apr 12, 2015 at 05:39 PM

Look for solution: http://answers.unity3d.com/questions/560154/unable-to-populate-systemgenericcollectionslist.html#answer-945499

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

13 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

Related Questions

A node in a childnode? 1 Answer

C# GameObject Lists 2 Answers

Issues outputting a list of strings 1 Answer

need help adding all gameobjects with a specific name to a list 1 Answer

how to debug in monodevelop 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