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 seyyid · Apr 04, 2011 at 08:57 AM · listcs0246burgzergarcade

Unity 3.2 using System.Collections.Generic; error

hello

i have been following the tutorial of burgzerg arcade until i face with problem using List<> component

i m currently using unity 3.2

the code line gives error is " private List _lootItems; " and i already have "using System.Collections.Generic; " defined at top

compiler still gives error as "the type or namespace name 'Item' could not be found. Are u missing a using directive or an assembly reference"

in tutorial video of burgzerg script can be compiled with no error why am i getting this error since i use the exact same code

thanx in advance.

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

2 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by KeithK · Apr 04, 2011 at 09:07 AM

Do you have a class defined with the name "Item" in your project?

And I think your list declaration would have to look like this:

private List<Item> _lootItems;
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 Bunny83 · Apr 04, 2011 at 10:57 AM 0
Share

Yeah, I would say that's the problem. You try to create a List<Item> but there is no Item class. $$anonymous$$aybe you missed something in the tutorial? I never used a tutorial so i don't know the one you talk about ;)

avatar image seyyid · Apr 05, 2011 at 12:38 AM 0
Share

i m sorry i posted wrong script it was already as you typed private List _lootItems; but still error, in tutorial he doesnt have Item class but as you said he most probably has that Item class as public from other script and calling it in this script, thanx for reply i ll try to solve with ur answer:)

avatar image
0

Answer by xander5532 · Jul 05, 2012 at 08:35 PM

i fixed it Item stands for a script he hase made and i heve it here

     using UnityEngine;
 
 
 public class Item {
  private string _name;
  private int _value;
  private RarityTypes _rarity;
  private int _curDur;
  private int _maxDur;
  
  
  
  public Item (){
  _name = &quot;Need Name&quot;;
  _value = 0;
  _rarity = RarityTypes.Common; 
  _maxDur = 50; 
  _curDur = _maxDur; 
  }
  public Item(string name, int value, RarityTypes Rare,  int maxDur, int curDur){
  _name = name;
  _value = value;
  _rarity = Rare; 
  _maxDur = maxDur; 
  _curDur = curDur; 
  
  }
  
  
  
  public string Name {
  get{ return _name; }
  set {_name = value; }
  }
  public int Value {
  get { return _value; }
  set { _value = value;} 
  }
  public RarityTypes Rare{
  
  get {return _rarity; }
  set {_rarity = value;} 
  
  }
  public int MaxDuribility {
  get { return _maxDur;}
  set {_maxDur = value;} 
  }
  public int CurDuribility {
  get { return _curDur;}
  set {_curDur = value;} 
  }
 }
 
 public enum RarityTypes{
  Common,
  Uncommon,
  Rare
  
 }
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 SisterKy · Jul 05, 2012 at 08:36 PM 0
Share

(please learn to format your code by marking it and hitting the little 101010 button; I did it for you this time...)

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

2 People are following this question.

avatar image avatar image

Related Questions

A node in a childnode? 1 Answer

CS0264 - List 1 Answer

What does "The type or namespace name x could not be found" mean? 5 Answers

ArrayLists vs Generic Lists 1 Answer

Maximum elements in a Generic List 0 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