I have an array of a class witch is called Block. The block class two variables: position(witch is a Vector3) and type(String). In my script I assign the position and type through a for loop. When I run the script it creates an array of 9 "Blocks". My next step is to make each Block of the array check if there are any blocks around it with the type of "dirt", but after an hour of trying I ended up with nothing. Could anyone help be do this? I think I need a for loop that checks if a block is at a specific position and has a specific type.
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
To help users post good questions and use the site effectively we have posted a user guide. Please check it out.
Answers and Comments
3 People are following this question.
How to check if a specific gameobject is in the array?
Camera rotation around player while following.
Array doesn't increase or add element
How do I instantiate same tag/name GameObjects with an array
Storing transforms from objects in Array