Object instantiation location list issue
I've got a game going just now that I've made a resource deposit that, when "mined" spawns a chunk of the appropriate resource at 1 of 6 child locations of the main deposit, these spawn locations are being held in a list on the main object.
Then when the resource chunk is to be created, it is instantiated at a random one of the 6 locations.
the issue I'm having is that when the chunk is created, if there is more than one of the deposits on the scene, the chunk will always spawn at one of the 6 locations of the bottom most deposit on the hierarchy.
Not entirely sure what I've done but any help will be appreciated. Thanks!
Answer by BigRedMusey · Aug 28, 2019 at 06:17 PM
[UPDATE] - A friend pointed out that I was not properly informing the code which one of the deposits I was referencing. I've added to the IF statement is true if the progress is >= 1 and that if the currently Highlighted gameobject (that I am mining from) is the same as the "Currently highlighted" variable in another script.
IF (carMan.progress >= 1 && gameObject == carMan.currentlyHighlighted)