Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 Keith18127389 · Jul 04, 2011 at 07:01 AM · c#errorcs0246

Compiler errors?

I got this strange error and cant figure how to fix it?

using UnityEngine; using System.Collections; using System.Collections.Generic;

public class Loot : MonoBehaviour { public float lootwindowheight = 90; public float Buttonheight = 40; public float Buttonwidth = 40; private List _lootItems; private float OFF_SET = 10; private const int LOOT_WINDOW_ID = 0; private Rect _lootWindow = new Rect(0,0,0,0);

 // Use this for initialization
 void Start () {
    _lootItems = new List <Item>();
     
     Populate();
 }
 
 // Update is called once per frame
 void Update () {
      
 }


  void OnGUI() {
      _lootWindow = GUI.Window(LOOT_WINDOW_ID, new Rect(OFF_SET, Screen.height - (OFF_SET + lootwindowheight), Screen.width - (OFF_SET * 2), lootwindowheight), LootWindow, "Loot Window");
  }
  
  private void LootWindow(int id) {
      for(int cnt = 0; cnt < _lootItems.Count; cnt++) {
          GUI.Button(new Rect(Buttonwidth * cnt, 0, Buttonwidth, Buttonheight), cnt.ToString());
      }
  }
  
  private void Populate() {
      for(int cnt = 0; cnt < 25; cnt++)
      _lootItems.Add(new Items());
  }

}

Comment
Add comment · Show 2
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 Dreamora · Jul 04, 2011 at 07:05 AM 0
Share

what is the error and on which line is it reported?

avatar image Keith18127389 · Jul 04, 2011 at 07:09 AM 0
Share

_lootItems = new List (Item)(); //Error is here

and it says Item could not be found?

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by testure · Jul 04, 2011 at 08:02 AM

Specifically, what is the error you're getting. Just copy and paste it. I'm inclined to believe that the error stems from the fact that you created an untyped private list and the tried to initialize it with type "item".

Always post your error if you're getting one, and always make sure your code is properly formatted before you post your question :)

Qato likes to format half of a code block and leave the rest all messed up.

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
avatar image
0

Answer by Dreamora · Jul 04, 2011 at 07:14 AM

then there is no class called Item thats present in this or an earlier compile step.

See the advanced manual on compilation order to know whats being compiled first to ensure that this class here is not within that one. Should you mix C# and UnityScript it will also tell you what to keep in mind to have one of them use the other

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

error CS0246: The type or namespace name `List' could not be found. 1 Answer

Error building Player because scripts had compiler errors 2 Answers

Multiple Cars not working 1 Answer

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

Base Character error 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