0

Lists and grid

Alessandro 1 year ago updated by JasonJonesLASM 10 months ago 2

I'm trying to do something that in my mind is quite simple, but I can't figure out in Bolt.

Note, I don't have any scripting experience but I've been sing Bolt for more than a year and I usually manage to solve all my problems with just Bolt and Unity scripting api, but this time I'm defeated.

I want to create a matrix, let's say 5 by 5, assign values to each position of the grid, then retrieve then one by one and get their value, or check the value of 1 square and do something based on the value of those around it. Once I now how to create that matrix I should be fine, but the first step eludes me.

In my mind it should be something like:

- create a variable of type grid or matrix or something like that with size x and y

- Assign value to cell x;y (example set cell 3;5 the value10)

And so forth.

The problem is that I can't find a way to create that initial imaginary grid.

Anyone can point me in the right direction?

Bolt Version:
Unity Version:
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):

Anything? Is this even possible in Bolt?

+1

Unity doesn't really display multidimensional collections without a custom drawer. There are 2 ways I'm aware of.

Easiest, but least flexible would be using this multidimensional array custom unit add-on I made:

http://lifeandstylemedia.com/assets/bolt/multiarray/manual.php

If you want more flexibility over how you manipulate the grid setup you can use a dictionary. The key would be a Vector2 for grid position and lookup, while the value is that positions data.