Objects positions in an Array
Hey there, im pretty new into Unity and specially into coding. im good with basics of C (from my study).
As i cant find any good tutorials on this matter and cant find my answers from google i wanted to ask here.
so im building a RTS like Game, i want to pseudo randomize the levels later on. (Like Forest can be on X Positions with X diffrent Shapes and X Different Trees, so predefined Positions) But there hasnt to be a Forest after all (At this positon)
The gatherer wont be player controlled so i want the AI to find the nearest position of tree from his own position. Thats why i need (as far as i understand coding) all the positions of every tree.
So i wonder how to save different positions/transforms of an prefab into an array. So i can sort these transforms for the nearest.
What would i need to do, do a small script on every prefab which calls out its own position for an empty gameobject script?
Any ideas how to approach this and what to read about it?
Your answer
Follow this Question
Related Questions
assigning gameobjects to an 2Darray 0 Answers
Random.Range isn't returning whole numbers 1 Answer
instantiating into array 2 Answers
error CS0201 1 Answer
HOW TO.. Grouping gameobject and move object in arraylist (Runtime) 0 Answers