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 artofshashank · Feb 17, 2014 at 12:25 PM · listmonodevelopienumerator

Monodevelop Does not Access List or IEnumerator?

I'm trying to access IEnumerator and List<> in my code; and for some reasons both are giving errors for non-existence.

I'm using Windows 8 and Unity 4.3.4.

Is this any bug or do I have to call more classes to be able to access them?

Thanks.

Comment
Add comment
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

3 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by emalb · Feb 17, 2014 at 01:44 PM

Google 'c# list' and follow the first link, which is almost always going to take you to a page on the Microsoft Developer Network. When you get there look for the namespace and you'll see it's System.Collections.Generic, so just add 'using System.Collections.Generic' at the top of your script, following the default 'using' statements that you'll find there.

Repeat for IEnumerator and you'll find it's in System.Collections, which is actually there by default. In this case, I think you should check your spelling of IEnumerator. I only say this because you have a typo in it in your question's title, so you may have the same one in your script too.

Comment
Add comment · Show 20 · 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 Bunny83 · Feb 17, 2014 at 02:00 PM 0
Share

Nothing to add ;)

+1

avatar image artofshashank · Feb 17, 2014 at 02:41 PM 0
Share

I know and already added that line :/

Now what?

avatar image artofshashank · Feb 17, 2014 at 02:43 PM 0
Share

And no, its just the typo in the headline. :(

avatar image emalb · Feb 17, 2014 at 03:15 PM 0
Share

Oh, that's a pity. In that case, I would ask you to post some example code and we'll see if anyone can get us further.

avatar image emalb · Feb 21, 2014 at 10:11 AM 1
Share

@artofshashank If you're on Windows, you can use ALT-Space when you get that problem with the dialog appearing behind the splash screen. That bring up the dialog's window menu where you can cursor down to $$anonymous$$ove and then use the cursor keys to move the dialog box around (works on almost all windows.)

It doesn't solve your problem, of course! :)

Show more comments
avatar image
-1

Answer by Avi_Dwivedi · Feb 20, 2014 at 07:42 AM

I also faced this problem. make sure that you inherit MonoBehaviour in your class. without that LIst will not show in unity.

Comment
Add comment · Show 1 · 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 artofshashank · Feb 21, 2014 at 05:30 AM 0
Share

yep. All my scriptsright now are $$anonymous$$onobehaviour.

avatar image
0

Answer by MattMorris · Feb 20, 2014 at 05:53 AM

http://www.dotnetperls.com/list < dotnetperls is a great C# reference.. they take you step by step and explain whats going on. I used this early on when the msdn docs were a bit to much to handle, but anyway here is a working example of a list to try and to compare to:

 using UnityEngine;
 using System.Collections;
 using System.Collections.Generic;
 
     public class ListExample : MonoBehaviour {
     
         List<int> myInts = new List<int>();
     
         bool print = true;
         // Use this for initialization
         void Start () {
             myInts.Add(1);
             myInts.Add(99);
             myInts.Add(208);
         }
     
         static IEnumerable<int> YieldReturn()
         {
             yield return 1;
             yield return 2;
             yield return 3;
         }
     
         
         // Update is called once per frame
         void Update () {
             if(print)
             {
                 foreach(int myInt in myInts)
                 {
                     Debug.Log("my List values: " + myInt);
                 }
     
                 foreach (int i in YieldReturn())
                 {
                     Debug.Log("My IEnumerable values: " + i);
                 }
     
                 print = false;
             }
         }
     }


http://stackoverflow.com/questions/3628425/ienumerable-vs-list-what-to-use-how-do-they-work < also another great reference for IEnumerable vs Lists

If you place the above code in a new scene on a game object you should see whats expected. list will print 1, 99, and 208. while ienuerable will print 1,2,3 GL!

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 whydoidoit · Feb 21, 2014 at 01:35 AM 0
Share

Did you bother to read the comments to the question?

avatar image artofshashank · Feb 21, 2014 at 05:29 AM 0
Share

$$anonymous$$att$$anonymous$$orris....as Whydoidoit said...your code won't do any good to me. List, IEnumerator, IEnumerable....these things are not even getting accessed.

I know how they work. But thanks for sharing this anyways.

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

27 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 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

IEnumerator in Update 2 Answers

Everytime I alter code during runtime my lists break 0 Answers

Saving list of vector 3 using JSON 1 Answer

Monodevelop problem 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