0

C# Exercise: Sliders controlling Instantiate Prefabs to create a grid. I can't figure out the Destroy part

You have two sliders, one that controls the X-axis and the other the Y-axis. These sliders have a min value of 1 and a max value of 7. The Start value of these sliders needs to be set at 1. When playing the Scene, you need to already have a quad on the screen. When increasing the value of the X Slider, each time the value is increased, a new prefab appears on the screen. If the value is decreased, for example from 4 to 2, the quads in the X-Axis will gradually disappear. The same happens with the Y Slider, but the quads instantiate vertically instead of horizontally. Another requirement is that if you increase alternatively both sliders, a Prefab grid with the X and Y values of the sliders is formed. So for example, if you set the X Slider to 3 and the Y Slider to 4 in that order, there will be a grid of 3 columns by 4 rows. If you decrease the values to X = 2 and Y = 1 in that order, one column will disappear and then 2 rows. This is the code that I have https://code.sololearn.com/cd3BhtmFa4a1/?ref=app

10th Jun 2020, 11:39 AM
Angy
Angy - avatar
1 Odpowiedź
0
create a two-dimensional array and fill it with conditional operators depending on the position of the sliders, and then draw
12th Jul 2020, 5:00 AM
Андрей Митрахович
Андрей Митрахович - avatar