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.
To help users navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
3 People are following this question.
How do I make a block move to another blocks position
.getComponent() creates an Instance?
Instantiate randomly from array
Retrieving fields of a certain type