- Home /
Creating a visual representation based on an ArrayList
I'm not new to coding, but I am relatively new to unity.
Let me first describe my situation: I have an object that represents a boat. The boat is meant to be made up of a bunch of grid spaces separated into layers. Layer 0 is the very front of the ship, layer 1 is the next row of grid spaces, etc. The way I have this information stored in my object is with an ArrayList called layout.
layout[0] stores the amount of grid spaces in the very front
layout[1] stores the amount of spaces in the second layer, etc.
This effectively stores the width of the ship at each layer in the ship. It makes the entire layout of the ship easily stored in an ArrayList.
Here's my problem: I have a sprite that represents a single grid space. I would like to build a graphic view of the ship by rendering the correct amount of grid spaces in each layer, and organizing them correctly in the game view. I really have no idea how to start. Here is a picture to better describe what I'd like:
(The tiles are 32x32 pixels. The layer numbers are meant to start at 0, my mistake.)
All help is greatly appreciated, I'm not really sure where to begin.
Your answer
![](https://koobas.hobune.stream/wayback/20220613180609im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to set sprite size in pixels? 2 Answers
Flickering lines around images with transparency 2 Answers
How to render a quad without gameobject? 2 Answers
make grid of gameobjects between 2 points 2 Answers
Making a repeating chain of Sprites 1 Answer