Array2DEditor icon indicating copy to clipboard operation
Array2DEditor copied to clipboard

Grid broken when making new type

Open Kasprenius opened this issue 2 years ago • 6 comments

I'd love to get some help on this! Pretty new to Unity, how do I get this to form in a grid? Was hoping to get it to look similar to the Sprite grid, it is probably way more involved then I'm hoping Screenshot 2022-06-14 104251

Kasprenius avatar Jun 14 '22 16:06 Kasprenius

Hey Kadynsr! Thanks for using Array2DEditor :) What class exactly are you trying to render in each cell, is it a class of your own or from Unity? Anyway, in both cases, you will need to:

  • Add a CellRow class for it in Array2DEditor/Scripts/CellRowTypes
  • Write an Array2D class for it in Array2DEditor/Scripts/Array2DTypes/ObjectTypes
  • Write a PropertyDrawer for it, in Array2DEditor/Editor/PropertyDrawers/ObjectDrawers

You can take inspiration from the other classes you will find in these folders. And if this is what you did to get the result you're showing me, then feel free to send me your code so I can take a look at what's wrong!

Eldoir avatar Jun 15 '22 08:06 Eldoir

Hello Kadynsr, do you have any update on this? 😃

Eldoir avatar Oct 25 '22 08:10 Eldoir

I had the same problem and following your instructions fixed it! But my problem now is that I can't find the variable to change the rows and columns, it's always set at 3x3.

avicarpio avatar Oct 30 '22 15:10 avicarpio

Hello avicarpio, I will address this in a future version of Array2DEditor, as it's been asked for a long time. :)

Eldoir avatar Nov 03 '22 13:11 Eldoir

Hey Kadynsr! Thanks for using Array2DEditor :) What class exactly are you trying to render in each cell, is it a class of your own or from Unity? Anyway, in both cases, you will need to:

  • Add a CellRow class for it in Array2DEditor/Scripts/CellRowTypes
  • Write an Array2D class for it in Array2DEditor/Scripts/Array2DTypes/ObjectTypes
  • Write a PropertyDrawer for it, in Array2DEditor/Editor/PropertyDrawers/ObjectDrawers

You can take inspiration from the other classes you will find in these folders. And if this is what you did to get the result you're showing me, then feel free to send me your code so I can take a look at what's wrong!

Hi Eldoir, really great tool to have. But i am having trouble creating a grid for a custom class. Could you please write a bit of reference code for say a (class with 1 char and 2 bools) in a grid formation. Thanks for the help!

AJAdityaJain avatar Jul 19 '23 12:07 AJAdityaJain

Hi @AJAdityaJain, thanks for your comment! In fact, I'm also having trouble creating a grid for a custom class. This issue has been raised a few days ago actually: https://github.com/Eldoir/Array2DEditor/issues/16. I think I... simply never tried with a custom serializable class, only simple cases with basic/Unity types. I'm actively working on this since it's a quite limiting issue. I'll keep you posted!

Eldoir avatar Jul 24 '23 22:07 Eldoir