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
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.