Hello Community,
I would like to instantiate multiple objects at the same time in a vertical arrangement. Currently my code looks like this:
GameObject hazard = hazards [Random.Range (0, hazards.Length)];
Vector3 spawnPosition1 = new Vector3 (20, 5, 0);
Vector3 spawnPosition2 = new Vector3 (20, 3, 0);
Vector3 spawnPosition3 = new Vector3 (20, 1, 0);
Vector3 spawnPosition4 = new Vector3 (20, -1, 0);
Vector3 spawnPosition5 = new Vector3 (20, -3, 0);
Vector3 spawnPosition6 = new Vector3 (20, -5, 0);
Quaternion spawnRotation = Quaternion.identity;
Instantiate (hazard, spawnPosition1, spawnRotation);
Instantiate (hazard, spawnPosition2, spawnRotation);
Instantiate (hazard, spawnPosition3, spawnRotation);
Instantiate (hazard, spawnPosition4, spawnRotation);
Instantiate (hazard, spawnPosition6, spawnRotation);
Is there a way to instantiate all my hazards at their respective positions in a single line of ‘Instantiate’-code, instead of having to repeatedly instantiate each individual object at each individual position?
Thank you!!
Are you using the AssetsManager pulgin? If you are, then follow up to the 4 chapter. If you try using IIS the connection with fail. Set up your local server to an apache service, like the one included in Xamp , your connection will then be successful. Make sure you are really exporting the bundles
– itzjac_dagon