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 /
  • Help Room /
avatar image
0
Question by happy_life · Apr 12, 2016 at 04:28 PM · c#gameobjectarrayunity4

Assigning variables to multiple gameobjects

I have 3 types of Gameobjects, (books) fic, romanace and nonfic.

I will assign three Gameobjects to 3 seperate arrays that store their variables. (or is there any better way?)

I want to assign them with variables such as title, author, size. The size will be generated randomly and then put into the array that hold the information of the title and author. User will choose which size of books they wanted to throw away (destroying the GameObject)

below is the code for the size and transformation to the gameobject.

  public int transform(){
         float sizeValue;
         sizeValue = Random.value;
         size= Mathf.RoundToInt (500*sizeValue+300);
         float s=size/100; //s is scale ratio 
         transform.localScale += new Vector3(s,s,s);
         return s;
     }

I donno how to make the arrays for the gameobject and assign them with variables, also, adding the random generated function from another class. Can someone provide guidance on this? Thank you

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 AdamBebko · Apr 13, 2016 at 07:27 AM 0
Share

I think to answer this question properly you need to add some detail about how the user is going to choose the books they want. If they are clicking on them you could do a raycast from the mouse, and on hit, delete what it hit.

0 Replies

· Add your reply
  • Sort: 

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

Getting collision for individual gameobjects in an array and changing properties of other gameobjects from that array 0 Answers

Access GameObject Array and Turn Render on via the key pressed - Keys are already named based on game object. 0 Answers

Can i chose game objects as parts of an array in a script ? 1 Answer

Getting collision from gameobjects in an array, and changing properties of other gameobjects from that array 0 Answers

[HELP C#] Making Gameobject 1 equal Prefab 2 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