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 Creeegan · Feb 23, 2014 at 09:50 PM · instanceboo

'x' is not a member of 'System.Type'.

 import UnityEngine
 
 class UpgradeMenuScript (MonoBehaviour):
     
     public class UpgradeData:
         
         public Upgrade1 = ("Rock Picker", 10, "5%", 7, 0.2)
         public test = 1
         
         public def constructor(te as int):
             te = test
     
     public UpgradeDataInstance = UpgradeData
     
     def Start():
         myUpgradeData = UpgradeDataInstance.test

This code is a test to see how I can access other variables (In this case, an array) from a class inside a script. I went through the whole "An Instance of Type 'X' is required to access non static member 'Y'" and people said to create an instance of it and I did. Now I get a new Error: "Assets/Upgrade Menu Stuff/UpgradeMenuScript.boo(16,39): BCE0019: 'test' is not a member of 'System.Type'."

Does anyone have any ideas on A: Whats causing it and B: How to fix it

Thanks, Jordan

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 robertbu · Feb 23, 2014 at 11:16 PM 0
Share

With Boo, you may have trouble getting answers to this question. I've only seen a few Boo questions in the last year, so there are not a lot of Boo programmers on this list.

avatar image Benproductions1 · Feb 24, 2014 at 11:29 AM 0
Share

@robertbu There might however be some Python programmers (like myself) and Boo is really just C# + Python (when it comes to syntax)

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Benproductions1 · Feb 24, 2014 at 11:42 AM

Hi! Python programmer here, just giving my 2 cents.
So I might be wrong ;)

When you define a new class, you are defining a type. That type is accessed directly by it's name. If you want to make a new instance of this type, you simply need to __call__ the type:

 class Foo:
     pass
 
 //Foo is a type
 type(Foo) == type
 //True
 
 //Make a new instance of Foo
 bar = Foo()
 //bar is of type Foo
 type(bar) == Foo
 //True

Therefore on line 16 (where you get the error), you are actually trying to get a variable test from the type UpgradeData, not from an instance of it.

I'll leave the fixing part up to you, but if you read my answer carefully i've already told you how to solve it.

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 Creeegan · Feb 24, 2014 at 03:52 PM 0
Share

The problem was actually the constructor. I was accessing test even though I assigned it to te but when I changed it to .te it wouldn't work either so that will have to do. $$anonymous$$aybe I'm using the constructors wrong. Anyway thanks for the reply. Not sure if that was what you had in $$anonymous$$d but it works now right? But if I add a constructor I get a new Error. I'll cross that bridge when It comes to it. Thanks for the help.

avatar image Benproductions1 · Feb 25, 2014 at 06:37 AM 0
Share

$$anonymous$$y answer solves the one error you posted. I specifically left our the rest with the constructor, as that was not what you asked. If you get a new error, then the one you were getting is solved and therefore the question answered.

You should do some research on OO, which should solve most of your problems.

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

20 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

Related Questions

Calling a function across all instances of an object 2 Answers

How do I fix: Object reference not set to an instance of an object 2 Answers

Creating fields/instance variables 1 Answer

ArrayLists vs Generic Lists 1 Answer

How can i play MovieTextures of Prefab instances independently? 2 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