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 psychentist · Dec 18, 2011 at 08:14 PM · elements

Adding elements to a script

Ok, this is a tricky one, let's see if I can explain it. I have a script that makes a wall of cubes. There's variations in which cube the comp decides to print, based on probability and specification. Whew. Basically, I have a "background" cube that consist of most of the grid. Then, there's a rarity color, which prints the math pattern, then, there's also the specific variation, which is a series of values to manually draw a 3d rectangle of cubes within the whole array, of yet a third color.

Did I lose you yet? Ok, so here's the question. How can I address the script to allow me to make "elements" in the editor, where each element is a specific mod? (a list of values)

Comment
Add comment · Show 1
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 jahroy · Dec 18, 2011 at 08:28 PM 3
Share

Yes, hard to follow. Are you reaching for an answer about how to create arrays of custom classes and dynamically add items to them?

What do you mean by list of values and what do you mean by "elements" in the editor?

It sounds like you want to have an array in your script that you can edit in the Inspector, but I'm not sure.

2 Replies

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

Answer by psychentist · Dec 21, 2011 at 08:08 PM

Turns out I needed an array of custom classes. Thx for your input guys. Jahroy had the right answer.

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 psychentist · Dec 19, 2011 at 06:29 PM

I need the code itself to be flexible to the number of variables. I mean elements like the elements in the input manager. You can create a new "element". Each element is an array describing the input and how to interpret it. but the number of arrays is variable. The problem im having is that the code itself must change to accomodate different numbers of element. I'm trying to avoid

 If elements =  1, do this.
 If elements = 2, do that
 ... Ad infinatum...
 

Is that any clearer?

I need a function that will allow mw to create a variable, who's name is stored in a varable. It needs to be something like

 Create an element, containing variables, who's names are (the value of varaible 1), (the value of variable 2,)... And insert   The following code into it.
 
 // insert code here. `
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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

is it possible to use completely custom made gui elements for unity's extension? 0 Answers

My List only works on last element when I use it to find a path to open into my Resources folder. 1 Answer

How to add Elements? Multiple ones!????? Help PLease 1 Answer

UI buttons and text are being shown as black area 3 Answers

How to get a list of all the GUI elements in a scene? 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