Getting The Element Int OF An Array

Hey so i have an array of GameObjects which correspond to another array of game objects.
What im going to do is use a foreach loop to see which ones has the z axis at the number i want and then if it is make the same array element number of another GameObject array active aswell,

So basically if Obj[1] is in the right place on the Z axis then SecondObj[1] will be made active

So… how’s it going?

If you’re comparing floating point numbers (such as transform.position.z) be sure you do so by asking if the difference between the two values is below a certain amount. NEVER check floating point numbers for equality. Here’s why.

Floating (float) point imprecision:

Never test floating point (float) quantities for equality / inequality. Here’s why:

https://starmanta.gitbooks.io/unitytipsredux/content/floating-point.html

How to report your problem productively in the Unity3D forums:

http://plbm.com/?p=220

This is the bare minimum of information to report:

  • what you want
  • what you tried
  • what you expected to happen
  • what actually happened, especially any errors you see
  • links to documentation you used to cross-check your work (CRITICAL!!!)

If you post a code snippet, ALWAYS USE CODE TAGS:

How to use code tags: Using code tags properly