I'm trying to make a Grid who will be easily convertible between 2D and 3D and I'm having a problem with overlapping prefabs in the case of the 3D generation.
The thing is, the DataObjects (Tiles) actualy have inside them the prefab of the thing who must be in that tile, but the prefab is bigger than the Tile.
As you can see in the image, i have 3 Tiles selected, Each Tile have a prefab and all of them have the same kind of prefab, they are in the scene highlighted by the orange borders right now in the image.
Then you could imagine than, if the prefabs are equal between the 3 of them they should all have th same size, and that's exactly the case (i.e. in fact they have the same size) but the thing is they are overlaping each other, have that in consideration when looking at the image.
So the question will be...
How to make sure two Tiles not overlap each other?
Based on a suggestion on working not with scale but pixels with units, I don't exactly how to do that, but searching on google make me try this, which actually doesn't work:
tile.tile_GO.GetComponent<Renderer>().bounds.size = thisPrefab.GetComponent<Renderer>().bounds.size;
It doesn't work because "bounds" is read only.
Do you know a work around to solve this? Is there another way to achieve what I'm looking for?
The idea is stop the overlapping, if you know a way to make one next to the other one, or even leave a gap between them in runtime, it will be also consider a valid answer.
Thanks in advance.
PS: I'm using Unity 2017.1.0f3, scripting in C#.