How to define simple Array in Flow Graph

agan 4 years ago updated by Lazlo Bonin (Lead Developer) 3 years ago 11


I want to define below code to graph:

float[] data = new float[64];

i didnt found Array in Fuzzy Finder :

Thanks in Advance...

Bolt Version:
Unity Version:
Scripting Backend:
.NET Version (API Compatibility Level):
Satisfaction mark by agan 4 years ago

Use List or you can add array to your Type option. Under Tools/Bolt/ Unit option wizard then click either human or programmer then click next and then click add at the bottom by clicking the plus then add the array, just type in array.

Thanks, i'll try...


Yes, using the units under Collections/List is essentially the same as using arrays. It also has the advantage that your list is resizable.

hi, lazlo

List <RaycastHit2D> does not work when using the Unity API: int Physics2D.RaycastNonAlloc (Vector2 origin, Vector2 direction, RaycastHit2D [] results, float distance).

Is there a way to create RaycastHit2D []?

hi did you find solution for this by any chance? 

Float arrays still seem to be missing from Bolt. How do I create an array with say, one million floats? The exact number will vary, so there has to be a node input for the size.

If the number of items in your collection will vary, it's a perfect use case for lists instead of arrays. Lists will resize as you add items to them, so you don't need to know their size ahead of time. The Create List unit can do that for you!

Lists would not be very performant for 1M float arrays. Right now I created utility methods in C-Sharp for createFloatArray etc. But it would be nice to have built in support, to make it possible to develop fully using Bolt, without the need to supplement with C-Sharp methods.

Indeed. We are working on full native typed array support for Bolt 2! See the roadmap here: https://www.notion.so/ludiq/Typed-Arrays-f577b4888b6541af8fa48499821fc8d7

Is there a way to create 2d arrays?


There is no native support for multidimensional .NET arrays at the moment.

However, you can use the good old method of jagged lists, e.g. a list of lists. The parent list contains columns and the children lists have rows as indices, so you can use two Get List Item units (first for X, second for Y), or vice versa.