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 question was closed Mar 28, 2015 at 11:09 AM by meat5000 for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by mugen-sosa · Mar 15, 2015 at 01:56 AM · unity 5system.collections.generic

It is not possible to invoke an expression of type 'System.Collections.Generic.List.

Hi all, im having a problem with this code that tells me this: It is not possible to invoke an expression of type 'System.Collections.Generic.List.', ihave a class called itemHandler that i call with system.collections.generic, (or something like that, im new with this) also im in unity 5 can someone help me? this is the code thx =)

 import System.Collections.Generic;
 
 
 var equipList : List. = new List.();
 var update : boolean = false;
 
 
 private var itemIcon : Texture2D;
 
 
 
 
 function Start () {
 //Equipment [0 = Head, 1 = Chest, 2 = Legs, 3 = RightHands, 4 = LeftHand,etc ]
 //head
 equipList.Add(new ItemHandler(0, itemIcon, "", "", false, ItemType.Head));
 //chest
 equipList.Add(new ItemHandler(0, itemIcon, "", "", false, ItemType.Chest));
 //Legs
 equipList.Add(new ItemHandler(0, itemIcon, "", "", false, ItemType.Legs));
 //RightHand
 equipList.Add(new ItemHandler(0, itemIcon, "", "", false, ItemType.RightHand));
 //LeftHand
 equipList.Add(new ItemHandler(0, itemIcon, "", "", false, ItemType.LeftHand));
 
 
 }
 
 function Update () {
         
     if (!equipList(0).equipped && update){
         equipList(0)=(new ItemHandler(0, itemIcon, "", "", false, ItemType.Head));
         update = false;
     }
     
 
 }

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

1 Reply

  • Sort: 
avatar image
1
Best Answer

Answer by meat5000 · Mar 14, 2015 at 09:54 PM

Try declaring your list like this

 var equipList : List.<Type>;

where I presume your Type is ItemHandler

Edit : Access your elements with [i] instead of (i).

Comment
Add comment · Show 3 · 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 mugen-sosa · Mar 14, 2015 at 11:57 PM 0
Share

thank you for the answer but that dont work u.u you know another way to do that? and i see the code again in this page and see that this say: var equipList : List. = new List.();, but actually is: var equipmentList : List.< ItemHandler > = new List.< ItemHandler >();

avatar image meat5000 ♦ · Mar 15, 2015 at 01:56 AM 0
Share

When I tried that line with your code the stated error went away then I got all the regular errors associated with the rest of the references being missing in my project.

Access your elements with [i] ins$$anonymous$$d of (i).

avatar image mugen-sosa · Mar 15, 2015 at 11:56 PM 0
Share

edit: that works, thank you so much =)

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Two dynamic dropdowns from one source list 0 Answers

unity and interfacing with a real hardware 0 Answers

How to make a part of a texture on an object seamlessly change to another texture? 0 Answers

Optimization of the game and Viking Village asset 2 Answers

How do i code a Mesh collider ? 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