A grid with Bolt ?

Hello Unity lovers,

what is the best approach for you to generate at 8 x 8 grid size, like a chess board game for example ?

I think we have many possibilities, it seems to be easy, but for artist like me, it’s a little bit confuse.

Love you o/

Sev’

Hello ,
I suggest you design the grid lines in your 2d software and import the 2d sprite image into unity and finally create a material with the 2d image and add the material to a plane or quad

Typically, you’d do this with a 2D array in C#. Bolt 1 doesn’t handle arrays natively but there’s a community made extension for multidimensional arrays in this link: https://github.com/LifeandStyleMedia/UAlive/releases/tag/1_3_1
Import the package, then run Tools/Bolt/Build Unit Options. After that the multi array units should come up in search.

But then he can’t use it for gameplay, it’s just visual. Or are you suggesting divorcing the visuals from the game systems completely?

3 Likes

Idk mate, I just suggested something I thought would be easier to get done…
No offence mate

public GameObject ChessSquare;
for (x =1:x<9: x++)
{
for (y=1: y<9 = y++)
{
instantiate (ChessSquare, vector3(x,y,0), Qyarternion Identity);
}}

Somthing like this but with more experience and less bugs.

1 Like

it looks like an incantation :V but I understand the goal, I really love to try the same with bolt

Others ideas ?

(and thanks everybody o/)

Yes. i felt the same way. I’m learning Bolt too, and it’s much easier. I worked with the above equation before and was trying to firgure how to do it in Bolt, and it is so much clearer and easier to understand thanks to you asking this question. So here it is:

you can change the size by changing the “Last” values, and can plug in an “integer variable” for them to access them in the inspector. If you have more questions ill be happy to answer.

2 Likes

what i get

1 Like

Marry me !!!

Sorry, I am unfortunately attached.

2 Likes

I confirm it works, you rox, next step : rename each grid cube instance with their initial X Y positions

Oh jeez, that sounds complicated. Would you use Text Mesh Pro…how would you do that?

Great idea…How to execute? Let me talk to the rubber duck. Seems like we set the name of the instance after we create it. How do we set the name of an instance…must search through integrated docs it seems…

Another for loop…where to put it? add “Gameobject set name” unit after instantiate

how to write name?

This is why you need a 2D array from Jason’s extension here which lets you get a grid cell based on X,Y position and then do whatever you need with it, including renaming.

Getting started with Jason’s Multi Array: https://lifeandstylemedia.com/docs/manual/entries/bolt/multiarray/GettingStarted.php

Using Multi Array: https://lifeandstylemedia.com/docs/manual/entries/bolt/multiarray/UsingMultiArray.php

Download here: https://github.com/LifeandStyleMedia/UAlive/releases/tag/1_3_1

You’d then need to extend sinjinn’s graph. Create a new 2D array before the for loops and add the instantiated grid cell to the created array so you can retrieve it later and do something with it.

2 Likes

Owwwkayyy, I didn’t think it was so complicated, i thought of a get name and set it with the X Y value.

Maybe I 'll forget this kind of process.

I really want to try your idea Ex-crow, I’ll adding extension and see what happens. (do you have a powerful Graph image? )

Byyye, lov’ you guys \o/ ( Air check)

thanks i will check this out.

Hey, that seems like a great thing that I was not aware of. Do you know of any more similar Bolt related resources?

Superunit megapack: https://assetstore.unity.com/packages/tools/visual-scripting/bolt-super-units-177410

Better Unity Event integration: https://assetstore.unity.com/packages/tools/visual-scripting/bolt-unity-events-175821

That’s pretty much it for now.

1 Like

Thank You.

The screenshot below shows code for generating a 3D array of game objects and renaming them according to their x,y,z values. Use String Literal nodes and add the index of each for loop to get the full name which is then set via Name(Set).

Further off screen in the macro the new game objects are also stored into a two nested AotList. Using three List(Get) in a row (each one’s int value set to the desired index) you can set your cursor to any one specific game object in the array. For example: List(Get) 1, List(Get) 7, List(Get) 4, would return the cube generated at 1,7,4 from the 3D list array.

This code works the same for a 2D array, you just use one less for loop. Either way you don’t need to use any other extensions. If you want to access the 3D array in other macros just save it as a variable with Variable(Set) and access it with Variable(Get). Easy Peasy.

3 Likes

I love Bolt but this is one of those cases where scripting is easier, even from a visual point of view.
I was storing my grid as a list of vec2.

1 Like