Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 superventure · Jun 29, 2013 at 02:13 PM · errorlistarrays

Can't get list to work (simple)

Hey out there. I am trying to learn how to use lists in js.

I have

 var thing1 = new List.<GameObject>();
   var thing2 = new List.<GameObject>();

but I get this error message

ssets/My scripts/tryout.js(119,17): BCE0005: Unknown identifier: 'List'.

what's wrong? I'm not finding any clear instructions anywhere that explain for js

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

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by robertbu · Jun 29, 2013 at 02:41 PM

You need the following at the top of the file:

 import System.Collections.Generic;
Comment
Add comment · Show 5 · 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 superventure · Jun 29, 2013 at 02:48 PM 0
Share

I tried that, but it throws millions of errors mainly on 'components of' parts of the script

avatar image robertbu · Jun 29, 2013 at 03:06 PM 0
Share

The import is necessary. Did you include the ';' at the end? The following compiles and runs:

 #pragma strict
 
 import System.Collections.Generic;
 
 var thing1 = new List.<GameObject>();
 var thing2 = new List.<GameObject>();
 
 function Start() {
 
 for (var i = 0; i < 10; i++)
   thing1.Add(new GameObject());
 
 }
avatar image superventure · Jun 29, 2013 at 03:23 PM 0
Share

I put that in a new script and it does work. I wonder why it threw so many errors on my initial script?

this times * 100

 BCE0019: 'blank' is not a member of 'blank'. 

it also did

 BCE0005: $$anonymous$$ identifier: 'blank'.

avatar image robertbu · Jun 29, 2013 at 03:50 PM 0
Share

Don't know. If you want to post the entire script that generated the error, I'll take a look.

avatar image superventure · Jun 29, 2013 at 04:20 PM 0
Share

You'd be reading for 3 days. I think it had to with 'pragma strict' being added. It doesn't like getcomponent me thinks. I'm going to have to find alternative methods. I only wanted to dive into lists so I could serialize arrays.

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

15 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

Related Questions

A node in a childnode? 1 Answer

Need help with converting an array to a list in C#` 4 Answers

sort list by variable in list of ints array 2 Answers

Access tag from list 1 Answer

Hack and slash tutorial ModifiedStat Tutorial 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